diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-07-10 20:01:18 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-07-10 23:10:17 +0200 |
| commit | 6a4823461f491aef63451f097ddfe5602e0b2157 (patch) | |
| tree | ad11b0ad169d030942d950573c729d50f7b3291b /src/library | |
| parent | 36b3067c19c8743032a44f888ee48702b88d135b (diff) | |
Reference-count complex values
Rename some nodes types
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/elements.rs | 4 | ||||
| -rw-r--r-- | src/library/layout.rs | 4 | ||||
| -rw-r--r-- | src/library/mod.rs | 2 | ||||
| -rw-r--r-- | src/library/text.rs | 8 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/library/elements.rs b/src/library/elements.rs index e669369a..6c6c66db 100644 --- a/src/library/elements.rs +++ b/src/library/elements.rs @@ -55,7 +55,7 @@ fn rect_impl( height: Option<Linear>, aspect: Option<N64>, fill: Option<Color>, - body: TemplateValue, + body: Template, ) -> Value { Value::template(move |ctx| { let mut stack = ctx.exec_template_stack(&body); @@ -99,7 +99,7 @@ fn ellipse_impl( height: Option<Linear>, aspect: Option<N64>, fill: Option<Color>, - body: TemplateValue, + body: Template, ) -> Value { Value::template(move |ctx| { // This padding ratio ensures that the rectangular padded region fits diff --git a/src/library/layout.rs b/src/library/layout.rs index 28ee27e1..d7ada806 100644 --- a/src/library/layout.rs +++ b/src/library/layout.rs @@ -20,7 +20,7 @@ pub fn page(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let right = args.named(ctx, "right"); let bottom = args.named(ctx, "bottom"); let flip = args.named(ctx, "flip"); - let body = args.expect::<TemplateValue>(ctx, "body").unwrap_or_default(); + let body = args.expect::<Template>(ctx, "body").unwrap_or_default(); Value::template(move |ctx| { let snapshot = ctx.state.clone(); @@ -108,7 +108,7 @@ pub fn align(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let second = args.eat::<AlignValue>(ctx); let mut horizontal = args.named::<AlignValue>(ctx, "horizontal"); let mut vertical = args.named::<AlignValue>(ctx, "vertical"); - let body = args.expect::<TemplateValue>(ctx, "body").unwrap_or_default(); + let body = args.expect::<Template>(ctx, "body").unwrap_or_default(); for value in first.into_iter().chain(second) { match value.axis() { diff --git a/src/library/mod.rs b/src/library/mod.rs index 7c3e0a71..28387218 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -18,7 +18,7 @@ use std::rc::Rc; use crate::color::{Color, RgbaColor}; use crate::eco::EcoString; -use crate::eval::{EvalContext, FuncArgs, Scope, TemplateValue, Value}; +use crate::eval::{EvalContext, FuncArgs, Scope, Template, Value}; use crate::exec::{Exec, FontFamily}; use crate::font::{FontStyle, FontWeight, VerticalFontMetric}; use crate::geom::*; diff --git a/src/library/text.rs b/src/library/text.rs index a0ffc56c..e6de04a1 100644 --- a/src/library/text.rs +++ b/src/library/text.rs @@ -23,7 +23,7 @@ pub fn font(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let serif = args.named(ctx, "serif"); let sans_serif = args.named(ctx, "sans-serif"); let monospace = args.named(ctx, "monospace"); - let body = args.expect::<TemplateValue>(ctx, "body").unwrap_or_default(); + let body = args.expect::<Template>(ctx, "body").unwrap_or_default(); Value::template(move |ctx| { let font = ctx.state.font_mut(); @@ -163,7 +163,7 @@ pub fn par(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let spacing = args.named(ctx, "spacing"); let leading = args.named(ctx, "leading"); let word_spacing = args.named(ctx, "word-spacing"); - let body = args.expect::<TemplateValue>(ctx, "body").unwrap_or_default(); + let body = args.expect::<Template>(ctx, "body").unwrap_or_default(); Value::template(move |ctx| { if let Some(spacing) = spacing { @@ -194,7 +194,7 @@ pub fn lang(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { } None => None, }; - let body = args.expect::<TemplateValue>(ctx, "body").unwrap_or_default(); + let body = args.expect::<Template>(ctx, "body").unwrap_or_default(); Value::template(move |ctx| { if let Some(dir) = dir.or(iso) { @@ -239,7 +239,7 @@ fn line_impl( let thickness = args.eat(ctx).or_else(|| args.named::<Linear>(ctx, "thickness")); let offset = args.named(ctx, "offset"); let extent = args.named(ctx, "extent").unwrap_or_default(); - let body = args.expect::<TemplateValue>(ctx, "body").unwrap_or_default(); + let body = args.expect::<Template>(ctx, "body").unwrap_or_default(); // Suppress any existing strikethrough if strength is explicitly zero. let state = thickness.map_or(true, |s| !s.is_zero()).then(|| { |
