2023-10-24 04:36:08 +00:00
|
|
|
use crate::error::CustomError;
|
|
|
|
|
2023-10-27 18:43:06 +00:00
|
|
|
use super::registry::Registry;
|
2023-10-27 19:32:24 +00:00
|
|
|
use super::IElement;
|
2023-10-27 18:43:06 +00:00
|
|
|
|
2023-10-24 04:36:08 +00:00
|
|
|
#[derive(Debug)]
|
2023-10-27 19:32:24 +00:00
|
|
|
pub(crate) struct ISection {
|
|
|
|
pub(crate) children: Vec<IElement>,
|
|
|
|
}
|
2023-10-24 04:36:08 +00:00
|
|
|
|
2023-10-27 17:05:34 +00:00
|
|
|
impl ISection {
|
2023-10-29 16:15:07 +00:00
|
|
|
pub(crate) async fn new<'intermediate, 'parse>(
|
|
|
|
registry: &mut Registry<'intermediate, 'parse>,
|
|
|
|
section: &'intermediate organic::types::Section<'parse>,
|
2023-10-27 18:43:06 +00:00
|
|
|
) -> Result<ISection, CustomError> {
|
2023-10-27 19:55:19 +00:00
|
|
|
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 })
|
2023-10-24 04:36:08 +00:00
|
|
|
}
|
|
|
|
}
|