summaryrefslogtreecommitdiff
path: root/src/library/boxed.rs
blob: e8debca4b4efad9b74eac63d839b66c814a4be18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)?)])
    }
}