natter/src/intermediate/section.rs

25 lines
569 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-27 19:32:24 +00:00
pub(crate) fn new<'parse>(
registry: &mut Registry<'parse>,
section: &organic::types::Section<'parse>,
) -> Result<ISection, CustomError> {
2023-10-27 19:32:24 +00:00
let children = section
.children
.iter()
.map(|obj| IElement::new(registry, obj))
.collect::<Result<Vec<_>, _>>()?;
Ok(ISection { children })
}
}