summaryrefslogtreecommitdiff
path: root/src/library/boxed.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-17 15:16:37 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-17 15:16:37 +0100
commitf6cb4d725ee6e4fd09b92b5af7348d11ac951b10 (patch)
tree7cf8bc7b0158a8a453fd9e2a2fe5a857ef036d5e /src/library/boxed.rs
parent4d0bdc4ca4cb5e8ca1a70b38a0fc0ec37d9e4857 (diff)
Update standard library functions 🎁
Diffstat (limited to 'src/library/boxed.rs')
-rw-r--r--src/library/boxed.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/library/boxed.rs b/src/library/boxed.rs
new file mode 100644
index 00000000..e8debca4
--- /dev/null
+++ b/src/library/boxed.rs
@@ -0,0 +1,21 @@
+use crate::func::prelude::*;
+
+/// `box`: Layouts content into a box.
+#[derive(Debug, PartialEq)]
+pub struct Boxed {
+ body: SyntaxTree,
+}
+
+function! {
+ data: Boxed,
+
+ parse(args, body, ctx) {
+ args.done()?;
+ let body = parse!(required: body, ctx);
+ Ok(Boxed { body })
+ }
+
+ layout(this, ctx) {
+ Ok(commands![AddMultiple(layout_tree(&this.body, ctx)?)])
+ }
+}