diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-10-26 17:11:08 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-10-26 17:14:11 +0200 |
| commit | 5c534fb42881b508175dd25129f62e604bdae403 (patch) | |
| tree | fab522708f55d3ee132cb7a0789de701b795d847 /src/library | |
| parent | fb0cd3df6e1e1077c6f19c319726c9aa9678325b (diff) | |
Simplify node construction
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/elements.rs | 2 | ||||
| -rw-r--r-- | src/library/layout.rs | 8 | ||||
| -rw-r--r-- | src/library/mod.rs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/library/elements.rs b/src/library/elements.rs index cd8a6f88..01efb405 100644 --- a/src/library/elements.rs +++ b/src/library/elements.rs @@ -99,6 +99,6 @@ fn shape_impl( fill: Some(Paint::Color( fill.unwrap_or(Color::Rgba(RgbaColor::new(175, 175, 175, 255))), )), - child: body.as_ref().map(|template| template.to_stack(style).into()), + child: body.as_ref().map(|template| template.to_stack(style).pack()), })) } diff --git a/src/library/layout.rs b/src/library/layout.rs index 4ef0926f..f7fb2882 100644 --- a/src/library/layout.rs +++ b/src/library/layout.rs @@ -154,7 +154,7 @@ pub fn boxed(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { width, height, fill: fill.map(Paint::Color), - child: Some(body.to_stack(style).into()), + child: Some(body.to_stack(style).pack()), } }))) } @@ -186,7 +186,7 @@ pub fn pad(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { Ok(Value::Template(Template::from_block(move |style| { PadNode { padding, - child: body.to_stack(&style).into(), + child: body.to_stack(&style).pack(), } }))) } @@ -227,7 +227,7 @@ pub fn stack(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { children.push(StackChild::Spacing(v)); } - let node = template.to_stack(style).into(); + let node = template.to_stack(style).pack(); children.push(StackChild::Node(node, style.aligns.block)); delayed = spacing; } @@ -283,7 +283,7 @@ pub fn grid(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { gutter: gutter.clone(), children: children .iter() - .map(|child| child.to_stack(&style).into()) + .map(|child| child.to_stack(&style).pack()) .collect(), } }))) diff --git a/src/library/mod.rs b/src/library/mod.rs index 6f8881c3..ac2085eb 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -20,7 +20,7 @@ use crate::diag::{At, TypResult}; use crate::eval::{Args, Array, EvalContext, Scope, Str, Template, Value}; use crate::font::{FontFamily, FontStretch, FontStyle, FontWeight, VerticalFontMetric}; use crate::geom::*; -use crate::layout::Spacing; +use crate::layout::{BlockLevel, Spacing}; use crate::style::Style; use crate::syntax::{Span, Spanned}; |
