summaryrefslogtreecommitdiff
path: root/library/src/text/deco.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-07 12:21:12 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-07 12:46:05 +0100
commitefd1853d069fbd1476e82d015da4d0d04cfaccc0 (patch)
tree842b745c134306539d10c61be9485794fe8dc7dc /library/src/text/deco.rs
parenteb951c008beea502042db4a3a0e8d1f8b51f6f52 (diff)
Show it!
- New show rule syntax - Set if syntax - Removed wrap syntax
Diffstat (limited to 'library/src/text/deco.rs')
-rw-r--r--library/src/text/deco.rs27
1 files changed, 16 insertions, 11 deletions
diff --git a/library/src/text/deco.rs b/library/src/text/deco.rs
index 10f3db38..fa0f05a7 100644
--- a/library/src/text/deco.rs
+++ b/library/src/text/deco.rs
@@ -37,12 +37,6 @@ impl<const L: DecoLine> DecoNode<L> {
fn construct(_: &mut Vm, args: &mut Args) -> SourceResult<Content> {
Ok(Self(args.expect("body")?).pack())
}
-}
-
-impl<const L: DecoLine> Show for DecoNode<L> {
- fn unguard_parts(&self, sel: Selector) -> Content {
- Self(self.0.unguard(sel)).pack()
- }
fn field(&self, name: &str) -> Option<Value> {
match name {
@@ -50,12 +44,14 @@ impl<const L: DecoLine> Show for DecoNode<L> {
_ => None,
}
}
+}
+
+impl<const L: DecoLine> Show for DecoNode<L> {
+ fn unguard_parts(&self, sel: Selector) -> Content {
+ Self(self.0.unguard(sel)).pack()
+ }
- fn realize(
- &self,
- _: Tracked<dyn World>,
- styles: StyleChain,
- ) -> SourceResult<Content> {
+ fn show(&self, _: Tracked<dyn World>, styles: StyleChain) -> SourceResult<Content> {
Ok(self.0.clone().styled(
TextNode::DECO,
Decoration {
@@ -81,6 +77,15 @@ pub(super) struct Decoration {
pub evade: bool,
}
+impl Fold for Decoration {
+ type Output = Vec<Self>;
+
+ fn fold(self, mut outer: Self::Output) -> Self::Output {
+ outer.insert(0, self);
+ outer
+ }
+}
+
/// A kind of decorative line.
pub type DecoLine = usize;