mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
This commit is contained in:
parent
21832453d9
commit
17506726cb
36 changed files with 280 additions and 271 deletions
|
|
@ -45,7 +45,7 @@ impl ToTokens for ViewDef {
|
|||
// that operate over constants and symbols.
|
||||
let builtin = builtins_with_boxes_output(quote! { #output }).map(|builtin|quote! {
|
||||
::tengri::dsl::Value::Exp(_, expr) => return Ok(Some(
|
||||
#builtin::take_or_fail(state, expr, ||"failed to load builtin")?.boxed()
|
||||
#builtin::try_provide(state, expr, ||"failed to load builtin")?.boxed()
|
||||
)),
|
||||
});
|
||||
// Symbols are handled by user-taked functions
|
||||
|
|
@ -63,11 +63,8 @@ impl ToTokens for ViewDef {
|
|||
/// Makes [#self_ty] able to construct the [Render]able
|
||||
/// which might correspond to a given [TokenStream],
|
||||
/// while taking [#self_ty]'s state into consideration.
|
||||
impl<'source, 'state: 'source>
|
||||
Take<'state, 'source, #self_ty>
|
||||
for Box<dyn Render<#output> + 'state>
|
||||
{
|
||||
fn take (state: &'state #self_ty, mut words: Cst<'source>) -> Perhaps<Self> {
|
||||
impl<'state> ::tengri::dsl::Dsl<Box<dyn Render<#output> + 'state>> for #self_ty {
|
||||
fn try_provide (state: &'state #self_ty, mut words: ::tengri::dsl::Ast) -> Perhaps<Box<dyn Render<#output> + 'state>> {
|
||||
Ok(if let Some(::tengri::dsl::Token { value, .. }) = words.peek() {
|
||||
match value { #(#builtin)* #(#exposed)* _ => None }
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue