summaryrefslogtreecommitdiff
path: root/src/library/structure/list.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-10-31 13:49:10 +0100
committerLaurenz <laurmaedje@gmail.com>2022-10-31 13:49:10 +0100
commit671ce3dedd40067bb5cea84fe0739de013827053 (patch)
treea4c990fc16b514f475dfceaa98d988e92ac6cf0c /src/library/structure/list.rs
parent636bdb9e438cfe4fb075a981e0512b9a3dde3e60 (diff)
Replace `encode` with `field`
Diffstat (limited to 'src/library/structure/list.rs')
-rw-r--r--src/library/structure/list.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/library/structure/list.rs b/src/library/structure/list.rs
index 082c98c3..8a57069e 100644
--- a/src/library/structure/list.rs
+++ b/src/library/structure/list.rs
@@ -90,16 +90,14 @@ impl<const L: ListKind> Show for ListNode<L> {
.pack()
}
- fn encode(&self, _: StyleChain) -> Dict {
- dict! {
- "tight" => Value::Bool(self.tight),
- "attached" => Value::Bool(self.attached),
- "items" => Value::Array(
- self.items
- .items()
- .map(|item| item.encode())
- .collect()
- ),
+ fn field(&self, name: &str) -> Option<Value> {
+ match name {
+ "tight" => Some(Value::Bool(self.tight)),
+ "attached" => Some(Value::Bool(self.attached)),
+ "items" => Some(Value::Array(
+ self.items.items().map(|item| item.encode()).collect(),
+ )),
+ _ => None,
}
}