matthewdown/blocks/
container.rs1use super::*;
2
3pub(crate) struct Container<'a>
4{
5 block: Box<dyn walker::Block + 'a>,
6 content: grammar::Token<'a>,
7 depth: usize
8}
9
10impl<'a> Container<'a>
11{
12 pub fn new(
13 block: Box<dyn walker::Block + 'a>,
14 content: grammar::Token<'a>,
15 depth: usize
16 )
17 -> Self
18 {
19 Self { block, content, depth }
20 }
21
22 pub fn block(&self) -> &dyn walker::Block { &self.block }
23
24 pub fn block_mut(&mut self) -> &mut dyn walker::Block { &mut self.block }
25
26 pub fn content(&self) -> Option<grammar::Token<'a>>
27 {
28 Some(self.content.clone())
29 }
30
31 pub fn depth(&self) -> usize { self.depth }
32}