natter/src/intermediate/paragraph.rs

25 lines
580 B
Rust
Raw Normal View History

2023-10-27 15:46:16 -04:00
use crate::error::CustomError;
use super::registry::Registry;
use super::IObject;
#[derive(Debug)]
pub(crate) struct IParagraph {
pub(crate) children: Vec<IObject>,
}
impl IParagraph {
pub(crate) fn new<'parse>(
registry: &mut Registry<'parse>,
paragraph: &organic::types::Paragraph<'parse>,
) -> Result<IParagraph, CustomError> {
let children = paragraph
.children
.iter()
.map(|obj| IObject::new(registry, obj))
.collect::<Result<Vec<_>, _>>()?;
Ok(IParagraph { children })
}
}