Add paragraph.
This commit is contained in:
24
src/intermediate/paragraph.rs
Normal file
24
src/intermediate/paragraph.rs
Normal 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 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user