Add paragraph.

This commit is contained in:
Tom Alexander
2023-10-27 15:46:16 -04:00
parent 5b34942b64
commit 4a6948cde7
7 changed files with 83 additions and 8 deletions

View File

@@ -0,0 +1,24 @@
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 })
}
}