natter/src/intermediate/section.rs
Tom Alexander f9377d7609
Make converstion to intermediate state async.
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.
2023-10-27 15:55:19 -04:00

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 })
}
}