mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
output: more big refactors
This commit is contained in:
parent
194f2f9874
commit
5e6338fad8
68 changed files with 1604 additions and 1016 deletions
|
|
@ -71,8 +71,8 @@ pub(crate) fn write_quote_to (out: &mut TokenStream2, quote: TokenStream2) {
|
|||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_proc_view () {
|
||||
let x: crate::proc_view::ViewMeta = pq! { SomeOutput };
|
||||
let output: Ident = pq! { SomeOutput };
|
||||
let x: crate::proc_view::ViewMeta = pq! { SomeOut };
|
||||
let output: Ident = pq! { SomeOut };
|
||||
assert_eq!(x.output, output);
|
||||
|
||||
// TODO
|
||||
|
|
@ -103,10 +103,10 @@ pub(crate) fn write_quote_to (out: &mut TokenStream2, quote: TokenStream2) {
|
|||
//]);
|
||||
// FIXME
|
||||
//let parsed: ViewDefinition = pq! {
|
||||
//#[tengri_proc::view(SomeOutput)]
|
||||
//#[tengri_proc::view(SomeOut)]
|
||||
//impl SomeView {
|
||||
//#[tengri::view(":view-1")]
|
||||
//fn view_1 (&self) -> impl Render<SomeOutput> + use<'_> {
|
||||
//fn view_1 (&self) -> impl Draw<SomeOut> + use<'_> {
|
||||
//"view-1"
|
||||
//}
|
||||
//}
|
||||
|
|
@ -114,19 +114,19 @@ pub(crate) fn write_quote_to (out: &mut TokenStream2, quote: TokenStream2) {
|
|||
//let written = quote! { #parsed };
|
||||
//assert_eq!(format!("{written}"), format!("{}", quote! {
|
||||
//impl SomeView {
|
||||
//fn view_1 (&self) -> impl Render<SomeOutput> + use<'_> {
|
||||
//fn view_1 (&self) -> impl Draw<SomeOut> + use<'_> {
|
||||
//"view-1"
|
||||
//}
|
||||
//}
|
||||
///// Generated by [tengri_proc].
|
||||
//impl ::tengri::output::Content<SomeOutput> for SomeView {
|
||||
//fn content (&self) -> impl Render<SomeOutput> {
|
||||
//impl ::tengri::output::Content<SomeOut> for SomeView {
|
||||
//fn content (&self) -> impl Draw<SomeOut> {
|
||||
//self.size.of(::tengri::output::View(self, self.config.view))
|
||||
//}
|
||||
//}
|
||||
///// Generated by [tengri_proc].
|
||||
//impl<'a> ::tengri::dsl::ViewContext<'a, SomeOutput> for SomeView {
|
||||
//fn get_content_sym (&'a self, value: &Value<'a>) -> Option<RenderBox<'a, SomeOutput>> {
|
||||
//impl<'a> ::tengri::dsl::ViewContext<'a, SomeOut> for SomeView {
|
||||
//fn get_content_sym (&'a self, value: &Value<'a>) -> Option<DrawBox<'a, SomeOut>> {
|
||||
//match value {
|
||||
//::tengri::dsl::Value::Sym(":view-1") => self.view_1().boxed(),
|
||||
//_ => panic!("expected Sym(content), got: {value:?}")
|
||||
|
|
|
|||
|
|
@ -77,12 +77,12 @@ impl ViewDef {
|
|||
quote! {
|
||||
/// Generated by [tengri_proc].
|
||||
///
|
||||
/// Makes [#self_ty] able to construct the [Render]able
|
||||
/// Makes [#self_ty] able to construct the [Draw]able
|
||||
/// which might correspond to a given [TokenStream],
|
||||
/// while taking [#self_ty]'s state into consideration.
|
||||
impl<'state> ::tengri::dsl::DslInto<Box<dyn ::tengri::output::Render<#output> + 'state>> for #self_ty {
|
||||
impl<'state> ::tengri::dsl::DslInto<Box<dyn ::tengri::output::Draw<#output> + 'state>> for #self_ty {
|
||||
fn dsl_into (&self, dsl: &impl ::tengri::dsl::Dsl)
|
||||
-> Perhaps<Box<dyn ::tengri::output::Render<#output> + 'state>>
|
||||
-> Perhaps<Box<dyn ::tengri::output::Draw<#output> + 'state>>
|
||||
{
|
||||
#(#builtins)*
|
||||
if let Some(sym) = dsl.sym()? {
|
||||
|
|
@ -128,9 +128,9 @@ fn _builtins_with_holes () -> impl Iterator<Item=(Builtin, TokenStream2)> {
|
|||
}
|
||||
|
||||
fn _builtins_with_boxes () -> impl Iterator<Item=(Builtin, TokenStream2)> {
|
||||
builtins_with(quote! { _ }, quote! { Box<dyn Render<_>> })
|
||||
builtins_with(quote! { _ }, quote! { Box<dyn Draw<_>> })
|
||||
}
|
||||
|
||||
fn builtins_with_boxes_output (o: TokenStream2) -> impl Iterator<Item=(Builtin, TokenStream2)> {
|
||||
builtins_with(quote! { _ }, quote! { Box<dyn Render<#o>> })
|
||||
builtins_with(quote! { _ }, quote! { Box<dyn Draw<#o>> })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue