f9377d7609
We are going to need to do things like call external tools for syntax highlighting so we are going to need async in there eventually.
27 lines
621 B
Rust
27 lines
621 B
Rust
use crate::error::CustomError;
|
|
|
|
use super::registry::Registry;
|
|
use super::IElement;
|
|
|
|
#[derive(Debug)]
|
|
pub(crate) struct ISection {
|
|
pub(crate) children: Vec<IElement>,
|
|
}
|
|
|
|
impl ISection {
|
|
pub(crate) async fn new<'parse>(
|
|
registry: &mut Registry<'parse>,
|
|
section: &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
|
|
};
|
|
|
|
Ok(ISection { children })
|
|
}
|
|
}
|