Remove intermediate lifetime.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::ast_node::IAstNode;
|
||||
use super::registry::FootnoteDefinitionContents;
|
||||
use super::registry::Registry;
|
||||
use super::IElement;
|
||||
use super::IObject;
|
||||
@@ -10,11 +9,13 @@ use super::IObject;
|
||||
pub(crate) struct IFootnoteDefinition {}
|
||||
|
||||
impl IFootnoteDefinition {
|
||||
pub(crate) async fn new<'intermediate, 'parse>(
|
||||
registry: &mut Registry<'intermediate, 'parse>,
|
||||
original: &'intermediate organic::types::FootnoteDefinition<'parse>,
|
||||
pub(crate) async fn new<'b, 'parse>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
original: &'b organic::types::FootnoteDefinition<'parse>,
|
||||
) -> Result<IFootnoteDefinition, CustomError> {
|
||||
registry.register_footnote_definition(original.label, &original.children);
|
||||
registry
|
||||
.register_footnote_definition(original.label, &original.children)
|
||||
.await?;
|
||||
Ok(IFootnoteDefinition {})
|
||||
}
|
||||
}
|
||||
@@ -26,33 +27,11 @@ pub(crate) struct IRealFootnoteDefinition {
|
||||
}
|
||||
|
||||
impl IRealFootnoteDefinition {
|
||||
pub(crate) async fn new<'intermediate, 'parse>(
|
||||
registry: &mut Registry<'intermediate, 'parse>,
|
||||
pub(crate) async fn new<'b, 'parse>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
footnote_id: usize,
|
||||
original: &FootnoteDefinitionContents<'intermediate, 'parse>,
|
||||
contents: Vec<IAstNode>,
|
||||
) -> Result<IRealFootnoteDefinition, CustomError> {
|
||||
let contents = match original {
|
||||
FootnoteDefinitionContents::FromReference(inner) => {
|
||||
let contents = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in inner.iter() {
|
||||
ret.push(IAstNode::Object(IObject::new(registry, obj).await?));
|
||||
}
|
||||
ret
|
||||
};
|
||||
contents
|
||||
}
|
||||
FootnoteDefinitionContents::FromDefinition(inner) => {
|
||||
let contents = {
|
||||
let mut ret = Vec::new();
|
||||
for obj in inner.iter() {
|
||||
ret.push(IAstNode::Element(IElement::new(registry, obj).await?));
|
||||
}
|
||||
ret
|
||||
};
|
||||
contents
|
||||
}
|
||||
};
|
||||
Ok(IRealFootnoteDefinition {
|
||||
footnote_id,
|
||||
contents,
|
||||
|
||||
Reference in New Issue
Block a user