diff --git a/library/src/layout/columns.rs b/library/src/layout/columns.rs index 4cf840cd4..0353e077d 100644 --- a/library/src/layout/columns.rs +++ b/library/src/layout/columns.rs @@ -64,14 +64,6 @@ impl ColumnsNode { } .pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "count" => Some(Value::Int(self.count.get() as i64)), - "body" => Some(Value::Content(self.body.clone())), - _ => None, - } - } } impl Layout for ColumnsNode { @@ -193,13 +185,6 @@ impl ColbreakNode { let weak = args.named("weak")?.unwrap_or(false); Ok(Self { weak }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "weak" => Some(Value::Bool(self.weak)), - _ => None, - } - } } impl Behave for ColbreakNode { diff --git a/library/src/layout/container.rs b/library/src/layout/container.rs index a77c0df9a..7814c0834 100644 --- a/library/src/layout/container.rs +++ b/library/src/layout/container.rs @@ -73,13 +73,6 @@ impl BoxNode { let baseline = args.named("baseline")?.unwrap_or_default(); Ok(Self { body, width, height, baseline }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.body.clone())), - _ => None, - } - } } impl Layout for BoxNode { @@ -196,13 +189,6 @@ impl BlockNode { args.named("below")?.map(VNode::block_around).or(spacing), ); } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.0.clone())), - _ => None, - } - } } impl Layout for BlockNode { diff --git a/library/src/layout/grid.rs b/library/src/layout/grid.rs index 6fea5bbc9..5e8b50d11 100644 --- a/library/src/layout/grid.rs +++ b/library/src/layout/grid.rs @@ -119,19 +119,6 @@ impl GridNode { } .pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "columns" => Some(Sizing::encode_slice(&self.tracks.x)), - "rows" => Some(Sizing::encode_slice(&self.tracks.y)), - "column-gutter" => Some(Sizing::encode_slice(&self.gutter.x)), - "row-gutter" => Some(Sizing::encode_slice(&self.gutter.y)), - "cells" => Some(Value::Array( - self.cells.iter().cloned().map(Value::Content).collect(), - )), - _ => None, - } - } } impl Layout for GridNode { diff --git a/library/src/layout/hide.rs b/library/src/layout/hide.rs index 4f46324f7..019dd2a6c 100644 --- a/library/src/layout/hide.rs +++ b/library/src/layout/hide.rs @@ -30,13 +30,6 @@ impl HideNode { fn construct(_: &Vm, args: &mut Args) -> SourceResult { Ok(Self(args.expect("body")?).pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.0.clone())), - _ => None, - } - } } impl Show for HideNode { diff --git a/library/src/layout/pad.rs b/library/src/layout/pad.rs index aeea430b6..e43763e5f 100644 --- a/library/src/layout/pad.rs +++ b/library/src/layout/pad.rs @@ -67,13 +67,6 @@ impl PadNode { let padding = Sides::new(left, top, right, bottom); Ok(Self { padding, body }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.body.clone())), - _ => None, - } - } } impl Layout for PadNode { diff --git a/library/src/layout/page.rs b/library/src/layout/page.rs index 6a0c07b0b..e38e6d874 100644 --- a/library/src/layout/page.rs +++ b/library/src/layout/page.rs @@ -375,13 +375,6 @@ impl PagebreakNode { let weak = args.named("weak")?.unwrap_or(false); Ok(Self { weak }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "weak" => Some(Value::Bool(self.weak)), - _ => None, - } - } } /// A header, footer, foreground or background definition. diff --git a/library/src/layout/place.rs b/library/src/layout/place.rs index d5edaa797..c64766ccc 100644 --- a/library/src/layout/place.rs +++ b/library/src/layout/place.rs @@ -64,13 +64,6 @@ impl PlaceNode { let out_of_flow = aligns.y.is_some(); Ok(Self(body.moved(Axes::new(dx, dy)).aligned(aligns), out_of_flow).pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.0.clone())), - _ => None, - } - } } impl Layout for PlaceNode { diff --git a/library/src/layout/repeat.rs b/library/src/layout/repeat.rs index ef630cf28..ec582c280 100644 --- a/library/src/layout/repeat.rs +++ b/library/src/layout/repeat.rs @@ -38,13 +38,6 @@ impl RepeatNode { fn construct(_: &Vm, args: &mut Args) -> SourceResult { Ok(Self(args.expect("body")?).pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.0.clone())), - _ => None, - } - } } impl Layout for RepeatNode { diff --git a/library/src/layout/spacing.rs b/library/src/layout/spacing.rs index 295d7f2fc..b287f33d6 100644 --- a/library/src/layout/spacing.rs +++ b/library/src/layout/spacing.rs @@ -61,14 +61,6 @@ impl HNode { let weak = args.named("weak")?.unwrap_or(false); Ok(Self { amount, weak }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "amount" => Some(self.amount.encode()), - "weak" => Some(Value::Bool(self.weak)), - _ => None, - } - } } impl HNode { @@ -164,14 +156,6 @@ impl VNode { }; Ok(node.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "amount" => Some(self.amount.encode()), - "weak" => Some(Value::Bool(self.weakness != 0)), - _ => None, - } - } } impl VNode { diff --git a/library/src/layout/stack.rs b/library/src/layout/stack.rs index afcb36967..1452a8892 100644 --- a/library/src/layout/stack.rs +++ b/library/src/layout/stack.rs @@ -58,26 +58,6 @@ impl StackNode { } .pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "dir" => Some(Value::dynamic(self.dir)), - "spacing" => Some(match self.spacing { - Some(spacing) => spacing.encode(), - None => Value::None, - }), - "items" => Some(Value::Array( - self.children - .iter() - .map(|child| match child { - StackChild::Spacing(spacing) => spacing.encode(), - StackChild::Block(content) => Value::Content(content.clone()), - }) - .collect(), - )), - _ => None, - } - } } impl Layout for StackNode { diff --git a/library/src/layout/transform.rs b/library/src/layout/transform.rs index e0014ac07..5d358e66d 100644 --- a/library/src/layout/transform.rs +++ b/library/src/layout/transform.rs @@ -55,13 +55,6 @@ impl MoveNode { } .pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.body.clone())), - _ => None, - } - } } impl Layout for MoveNode { @@ -147,13 +140,6 @@ impl RotateNode { } .pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.body.clone())), - _ => None, - } - } } impl Layout for RotateNode { @@ -237,13 +223,6 @@ impl ScaleNode { } .pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.body.clone())), - _ => None, - } - } } impl Layout for ScaleNode { diff --git a/library/src/text/misc.rs b/library/src/text/misc.rs index 2129059a1..184294d49 100644 --- a/library/src/text/misc.rs +++ b/library/src/text/misc.rs @@ -76,13 +76,6 @@ impl LinebreakNode { let justify = args.named("justify")?.unwrap_or(false); Ok(Self { justify }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "justify" => Some(Value::Bool(self.justify)), - _ => None, - } - } } impl Behave for LinebreakNode { diff --git a/library/src/text/shift.rs b/library/src/text/shift.rs index 9713c0c7e..a79676500 100644 --- a/library/src/text/shift.rs +++ b/library/src/text/shift.rs @@ -50,13 +50,6 @@ impl SubNode { fn construct(_: &Vm, args: &mut Args) -> SourceResult { Ok(Self(args.expect("body")?).pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.0.clone())), - _ => None, - } - } } impl Show for SubNode { @@ -130,13 +123,6 @@ impl SuperNode { fn construct(_: &Vm, args: &mut Args) -> SourceResult { Ok(Self(args.expect("body")?).pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => Some(Value::Content(self.0.clone())), - _ => None, - } - } } impl Show for SuperNode { diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs index 61b8afdb2..8a2567625 100644 --- a/library/src/visualize/shape.rs +++ b/library/src/visualize/shape.rs @@ -164,16 +164,6 @@ impl RectNode { let body = args.eat()?; Ok(Self { body, width, height }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => match &self.body { - Some(body) => Some(Value::Content(body.clone())), - None => Some(Value::None), - }, - _ => None, - } - } } impl Layout for RectNode { @@ -292,16 +282,6 @@ impl SquareNode { let body = args.eat()?; Ok(Self { body, width, height }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => match &self.body { - Some(body) => Some(Value::Content(body.clone())), - None => Some(Value::None), - }, - _ => None, - } - } } impl Layout for SquareNode { @@ -396,16 +376,6 @@ impl EllipseNode { let body = args.eat()?; Ok(Self { body, width, height }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => match &self.body { - Some(body) => Some(Value::Content(body.clone())), - None => Some(Value::None), - }, - _ => None, - } - } } impl Layout for EllipseNode { @@ -519,16 +489,6 @@ impl CircleNode { let body = args.eat()?; Ok(Self { body, width, height }.pack()) } - - fn field(&self, name: &str) -> Option { - match name { - "body" => match &self.body { - Some(body) => Some(Value::Content(body.clone())), - None => Some(Value::None), - }, - _ => None, - } - } } impl Layout for CircleNode {