use super::object::Object; use super::object::TextMarkup; use super::source::Source; #[derive(Debug)] pub struct Paragraph<'s> { pub source: &'s str, pub children: Vec>, } #[derive(Debug)] pub struct Comment<'s> { pub source: &'s str, } #[derive(Debug)] pub struct TableCell<'s> { pub source: &'s str, pub children: Vec>, } #[derive(Debug)] pub struct LesserBlock<'s> { pub source: &'s str, pub name: &'s str, pub data: Option<&'s str>, pub children: Vec>, } #[derive(Debug)] pub struct LesserBlockComment<'s> { pub source: &'s str, pub name: &'s str, pub data: Option<&'s str>, pub contents: &'s str, } impl<'s> Paragraph<'s> { pub fn of_text(input: &'s str) -> Self { let mut objects = Vec::with_capacity(1); objects.push(Object::TextMarkup(TextMarkup { source: input })); Paragraph { source: input, children: objects, } } } impl<'s> Source<'s> for Paragraph<'s> { fn get_source(&'s self) -> &'s str { self.source } } impl<'s> Source<'s> for TableCell<'s> { fn get_source(&'s self) -> &'s str { self.source } } impl<'s> Source<'s> for Comment<'s> { fn get_source(&'s self) -> &'s str { self.source } }