
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.
30 lines
711 B
Rust
30 lines
711 B
Rust
use crate::error::CustomError;
|
|
|
|
use super::registry::Registry;
|
|
use super::IObject;
|
|
|
|
#[derive(Debug)]
|
|
pub(crate) struct IHeading {
|
|
pub(crate) level: organic::types::HeadlineLevel,
|
|
pub(crate) title: Vec<IObject>,
|
|
}
|
|
|
|
impl IHeading {
|
|
pub(crate) async fn new<'parse>(
|
|
registry: &mut Registry<'parse>,
|
|
heading: &organic::types::Heading<'parse>,
|
|
) -> Result<IHeading, CustomError> {
|
|
let title = {
|
|
let mut ret = Vec::new();
|
|
for obj in heading.title.iter() {
|
|
ret.push(IObject::new(registry, obj).await?);
|
|
}
|
|
ret
|
|
};
|
|
Ok(IHeading {
|
|
title,
|
|
level: heading.level,
|
|
})
|
|
}
|
|
}
|