natter/src/intermediate/section.rs

27 lines
631 B
Rust
Raw Normal View History

use crate::error::CustomError;
use super::registry::Registry;
2023-10-27 19:32:24 +00:00
use super::IElement;
#[derive(Debug)]
2023-10-27 19:32:24 +00:00
pub(crate) struct ISection {
pub(crate) children: Vec<IElement>,
}
impl ISection {
2023-10-29 18:14:10 +00:00
pub(crate) async fn new<'b, 'parse>(
registry: &'b mut Registry<'parse>,
section: &'b organic::types::Section<'parse>,
) -> Result<ISection, CustomError> {
let children = {
let mut ret = Vec::new();
for elem in section.children.iter() {
ret.push(IElement::new(registry, elem).await?);
}
ret
};
2023-10-27 19:32:24 +00:00
Ok(ISection { children })
}
}