Remove dumb field functions

This commit is contained in:
Laurenz 2023-02-13 11:00:11 +01:00
parent 58adf1d025
commit db49b628f7
14 changed files with 0 additions and 195 deletions

View File

@ -64,14 +64,6 @@ impl ColumnsNode {
}
.pack())
}
fn field(&self, name: &str) -> Option<Value> {
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<Value> {
match name {
"weak" => Some(Value::Bool(self.weak)),
_ => None,
}
}
}
impl Behave for ColbreakNode {

View File

@ -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<Value> {
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<Value> {
match name {
"body" => Some(Value::Content(self.0.clone())),
_ => None,
}
}
}
impl Layout for BlockNode {

View File

@ -119,19 +119,6 @@ impl GridNode {
}
.pack())
}
fn field(&self, name: &str) -> Option<Value> {
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 {

View File

@ -30,13 +30,6 @@ impl HideNode {
fn construct(_: &Vm, args: &mut Args) -> SourceResult<Content> {
Ok(Self(args.expect("body")?).pack())
}
fn field(&self, name: &str) -> Option<Value> {
match name {
"body" => Some(Value::Content(self.0.clone())),
_ => None,
}
}
}
impl Show for HideNode {

View File

@ -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<Value> {
match name {
"body" => Some(Value::Content(self.body.clone())),
_ => None,
}
}
}
impl Layout for PadNode {

View File

@ -375,13 +375,6 @@ impl PagebreakNode {
let weak = args.named("weak")?.unwrap_or(false);
Ok(Self { weak }.pack())
}
fn field(&self, name: &str) -> Option<Value> {
match name {
"weak" => Some(Value::Bool(self.weak)),
_ => None,
}
}
}
/// A header, footer, foreground or background definition.

View File

@ -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<Value> {
match name {
"body" => Some(Value::Content(self.0.clone())),
_ => None,
}
}
}
impl Layout for PlaceNode {

View File

@ -38,13 +38,6 @@ impl RepeatNode {
fn construct(_: &Vm, args: &mut Args) -> SourceResult<Content> {
Ok(Self(args.expect("body")?).pack())
}
fn field(&self, name: &str) -> Option<Value> {
match name {
"body" => Some(Value::Content(self.0.clone())),
_ => None,
}
}
}
impl Layout for RepeatNode {

View File

@ -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<Value> {
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<Value> {
match name {
"amount" => Some(self.amount.encode()),
"weak" => Some(Value::Bool(self.weakness != 0)),
_ => None,
}
}
}
impl VNode {

View File

@ -58,26 +58,6 @@ impl StackNode {
}
.pack())
}
fn field(&self, name: &str) -> Option<Value> {
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 {

View File

@ -55,13 +55,6 @@ impl MoveNode {
}
.pack())
}
fn field(&self, name: &str) -> Option<Value> {
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<Value> {
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<Value> {
match name {
"body" => Some(Value::Content(self.body.clone())),
_ => None,
}
}
}
impl Layout for ScaleNode {

View File

@ -76,13 +76,6 @@ impl LinebreakNode {
let justify = args.named("justify")?.unwrap_or(false);
Ok(Self { justify }.pack())
}
fn field(&self, name: &str) -> Option<Value> {
match name {
"justify" => Some(Value::Bool(self.justify)),
_ => None,
}
}
}
impl Behave for LinebreakNode {

View File

@ -50,13 +50,6 @@ impl SubNode {
fn construct(_: &Vm, args: &mut Args) -> SourceResult<Content> {
Ok(Self(args.expect("body")?).pack())
}
fn field(&self, name: &str) -> Option<Value> {
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<Content> {
Ok(Self(args.expect("body")?).pack())
}
fn field(&self, name: &str) -> Option<Value> {
match name {
"body" => Some(Value::Content(self.0.clone())),
_ => None,
}
}
}
impl Show for SuperNode {

View File

@ -164,16 +164,6 @@ impl RectNode {
let body = args.eat()?;
Ok(Self { body, width, height }.pack())
}
fn field(&self, name: &str) -> Option<Value> {
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<Value> {
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<Value> {
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<Value> {
match name {
"body" => match &self.body {
Some(body) => Some(Value::Content(body.clone())),
None => Some(Value::None),
},
_ => None,
}
}
}
impl Layout for CircleNode {