Add children to heading.
This commit is contained in:
@@ -1,8 +1,31 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::registry::Registry;
|
||||
use super::IHeading;
|
||||
use super::ISection;
|
||||
use futures::future::{BoxFuture, FutureExt};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum IDocumentElement {
|
||||
Heading(IHeading),
|
||||
Section(ISection),
|
||||
}
|
||||
|
||||
impl IDocumentElement {
|
||||
pub(crate) fn new<'parse, 'b>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
original: &'b organic::types::DocumentElement<'parse>,
|
||||
) -> BoxFuture<'b, Result<IDocumentElement, CustomError>> {
|
||||
async move {
|
||||
match original {
|
||||
organic::types::DocumentElement::Heading(inner) => Ok(IDocumentElement::Heading(
|
||||
IHeading::new(registry, inner).await?,
|
||||
)),
|
||||
organic::types::DocumentElement::Section(inner) => Ok(IDocumentElement::Section(
|
||||
ISection::new(registry, inner).await?,
|
||||
)),
|
||||
}
|
||||
}
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user