2023-10-27 15:46:16 -04:00
|
|
|
use crate::error::CustomError;
|
|
|
|
|
|
|
|
use super::registry::Registry;
|
|
|
|
use super::IObject;
|
|
|
|
|
2023-10-29 15:36:15 -04:00
|
|
|
#[derive(Debug, Clone)]
|
2023-10-27 15:46:16 -04:00
|
|
|
pub(crate) struct IParagraph {
|
|
|
|
pub(crate) children: Vec<IObject>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl IParagraph {
|
2023-10-29 14:14:10 -04:00
|
|
|
pub(crate) async fn new<'b, 'parse>(
|
|
|
|
registry: &'b mut Registry<'parse>,
|
|
|
|
original: &'b organic::types::Paragraph<'parse>,
|
2023-10-27 15:46:16 -04:00
|
|
|
) -> Result<IParagraph, CustomError> {
|
2023-10-27 15:55:19 -04:00
|
|
|
let children = {
|
|
|
|
let mut ret = Vec::new();
|
2023-10-29 12:15:07 -04:00
|
|
|
for obj in original.children.iter() {
|
2023-10-27 15:55:19 -04:00
|
|
|
ret.push(IObject::new(registry, obj).await?);
|
|
|
|
}
|
|
|
|
ret
|
|
|
|
};
|
2023-10-27 15:46:16 -04:00
|
|
|
|
|
|
|
Ok(IParagraph { children })
|
|
|
|
}
|
|
|
|
}
|