diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-01 16:56:35 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-02 09:18:33 +0100 |
| commit | 37ac5d966ebaf97ac79c507028cd5b742b510b89 (patch) | |
| tree | 249d43ff0f8d880cb5d00c236993f8ff0c1f10d8 /src/model/func.rs | |
| parent | f547c97072881069417acd3b79b08fb7ecf40ba2 (diff) | |
More dynamic content representation
Diffstat (limited to 'src/model/func.rs')
| -rw-r--r-- | src/model/func.rs | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/model/func.rs b/src/model/func.rs index a4f63aa1..47ad4436 100644 --- a/src/model/func.rs +++ b/src/model/func.rs @@ -4,9 +4,7 @@ use std::sync::Arc; use comemo::{Track, Tracked}; -use super::{ - Args, Content, Eval, Flow, NodeId, Route, Scope, Scopes, StyleMap, Value, Vm, -}; +use super::{Args, Eval, Flow, Node, NodeId, Route, Scope, Scopes, StyleMap, Value, Vm}; use crate::diag::{SourceResult, StrResult}; use crate::syntax::ast::Expr; use crate::syntax::SourceId; @@ -52,7 +50,7 @@ impl Func { Ok(Value::Content(content.styled_with_map(styles.scoped()))) }, set: Some(|args| T::set(args, false)), - node: T::SHOWABLE.then(|| NodeId::of::<T>()), + node: Some(NodeId::of::<T>()), }))) } @@ -168,24 +166,6 @@ impl Hash for Native { } } -/// A constructable, stylable content node. -pub trait Node: 'static { - /// Whether this node can be customized through a show rule. - const SHOWABLE: bool; - - /// Construct a node from the arguments. - /// - /// This is passed only the arguments that remain after execution of the - /// node's set rule. - fn construct(vm: &mut Vm, args: &mut Args) -> SourceResult<Content>; - - /// Parse relevant arguments into style properties for this node. - /// - /// When `constructor` is true, [`construct`](Self::construct) will run - /// after this invocation of `set` with the remaining arguments. - fn set(args: &mut Args, constructor: bool) -> SourceResult<StyleMap>; -} - /// A user-defined closure. #[derive(Hash)] pub struct Closure { |
