diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-09 14:17:24 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-09 14:42:14 +0100 |
| commit | c38d72383d2068361d635d6c1c78ba97aa917801 (patch) | |
| tree | e758418a2d704d69dee88faf4a9a9c69b25b47ca /src/eval/func.rs | |
| parent | d7a65fa26d131179d9d82226e5ee1b562084e48a (diff) | |
Make all optional fields settable
Diffstat (limited to 'src/eval/func.rs')
| -rw-r--r-- | src/eval/func.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/eval/func.rs b/src/eval/func.rs index 8243b4f6..6f98e316 100644 --- a/src/eval/func.rs +++ b/src/eval/func.rs @@ -54,15 +54,11 @@ impl Func { /// Create a new function from a native rust node. pub fn from_node<T: Node>(mut info: FuncInfo) -> Self { - info.params.extend(T::properties()); + info.params.extend(T::params()); Self( Arc::new(Prehashed::new(Repr::Native(Native { - func: |ctx, args| { - let styles = T::set(args, true)?; - let content = T::construct(ctx, args)?; - Ok(Value::Content(content.styled_with_map(styles.scoped()))) - }, - set: Some(|args| T::set(args, false)), + func: |vm, args| T::construct(vm, args).map(Value::Content), + set: Some(T::set), node: Some(NodeId::of::<T>()), info, }))), @@ -281,10 +277,10 @@ pub struct ParamInfo { /// Can be true even if `positional` is true if the parameter can be given /// in both variants. pub named: bool, - /// Is the parameter required? - pub required: bool, /// Can the parameter be given any number of times? pub variadic: bool, + /// Is the parameter required? + pub required: bool, /// Is the parameter settable with a set rule? pub settable: bool, } |
