summaryrefslogtreecommitdiff
path: root/src/exec/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-09 22:56:44 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-09 22:56:44 +0100
commitf9197dcfef11c4c054a460c80ff6023dae6f1f2a (patch)
tree500d28b7a6e35eb99245deaa38367a19dc2aed7b /src/exec/mod.rs
parent06ca740d01b428f12f6bd327257cd05dce737b03 (diff)
Add arguments value 🏓
Diffstat (limited to 'src/exec/mod.rs')
-rw-r--r--src/exec/mod.rs28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/exec/mod.rs b/src/exec/mod.rs
index 25edcce3..c323cf49 100644
--- a/src/exec/mod.rs
+++ b/src/exec/mod.rs
@@ -59,17 +59,23 @@ pub trait ExecWith {
impl ExecWith for Tree {
fn exec_with(&self, ctx: &mut ExecContext, map: &ExprMap) {
for node in self {
- match node {
- Node::Text(text) => ctx.push_text(text),
- Node::Space => ctx.push_space(),
- Node::Linebreak => ctx.apply_linebreak(),
- Node::Parbreak => ctx.apply_parbreak(),
- Node::Strong => ctx.state.font.strong ^= true,
- Node::Emph => ctx.state.font.emph ^= true,
- Node::Heading(heading) => heading.exec_with(ctx, map),
- Node::Raw(raw) => raw.exec(ctx),
- Node::Expr(expr) => map[&(expr as *const _)].exec(ctx),
- }
+ node.exec_with(ctx, map);
+ }
+ }
+}
+
+impl ExecWith for Node {
+ fn exec_with(&self, ctx: &mut ExecContext, map: &ExprMap) {
+ match self {
+ Node::Text(text) => ctx.push_text(text),
+ Node::Space => ctx.push_space(),
+ Node::Linebreak => ctx.apply_linebreak(),
+ Node::Parbreak => ctx.apply_parbreak(),
+ Node::Strong => ctx.state.font.strong ^= true,
+ Node::Emph => ctx.state.font.emph ^= true,
+ Node::Heading(heading) => heading.exec_with(ctx, map),
+ Node::Raw(raw) => raw.exec(ctx),
+ Node::Expr(expr) => map[&(expr as *const _)].exec(ctx),
}
}
}