From 645ae267011bcb8d70f8f74abf90d2585babe512 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 29 Oct 2023 14:14:10 -0400 Subject: [PATCH] Remove intermediate lifetime. --- src/intermediate/angle_link.rs | 6 +- src/intermediate/ast_node.rs | 55 ++++++++++-------- src/intermediate/babel_call.rs | 6 +- src/intermediate/bold.rs | 6 +- src/intermediate/center_block.rs | 6 +- src/intermediate/citation.rs | 6 +- src/intermediate/citation_reference.rs | 6 +- src/intermediate/clock.rs | 6 +- src/intermediate/code.rs | 6 +- src/intermediate/comment.rs | 6 +- src/intermediate/comment_block.rs | 6 +- src/intermediate/diary_sexp.rs | 6 +- src/intermediate/document_element.rs | 6 +- src/intermediate/drawer.rs | 6 +- src/intermediate/dynamic_block.rs | 6 +- src/intermediate/element.rs | 6 +- src/intermediate/entity.rs | 6 +- src/intermediate/example_block.rs | 6 +- src/intermediate/export_block.rs | 6 +- src/intermediate/export_snippet.rs | 6 +- src/intermediate/fixed_width_area.rs | 6 +- src/intermediate/footnote_definition.rs | 39 +++---------- src/intermediate/footnote_reference.rs | 10 ++-- src/intermediate/heading.rs | 6 +- src/intermediate/horizontal_rule.rs | 6 +- src/intermediate/inline_babel_call.rs | 6 +- src/intermediate/inline_source_block.rs | 6 +- src/intermediate/italic.rs | 6 +- src/intermediate/keyword.rs | 6 +- src/intermediate/latex_environment.rs | 6 +- src/intermediate/latex_fragment.rs | 6 +- src/intermediate/line_break.rs | 6 +- src/intermediate/object.rs | 6 +- src/intermediate/org_macro.rs | 6 +- src/intermediate/page.rs | 6 +- src/intermediate/paragraph.rs | 6 +- src/intermediate/plain_link.rs | 6 +- src/intermediate/plain_list.rs | 6 +- src/intermediate/plain_list_item.rs | 6 +- src/intermediate/plain_text.rs | 6 +- src/intermediate/planning.rs | 6 +- src/intermediate/property_drawer.rs | 6 +- src/intermediate/quote_block.rs | 6 +- src/intermediate/radio_link.rs | 6 +- src/intermediate/radio_target.rs | 6 +- src/intermediate/registry.rs | 75 +++++++++++++++++-------- src/intermediate/regular_link.rs | 6 +- src/intermediate/section.rs | 6 +- src/intermediate/special_block.rs | 6 +- src/intermediate/src_block.rs | 6 +- src/intermediate/statistics_cookie.rs | 6 +- src/intermediate/strike_through.rs | 6 +- src/intermediate/subscript.rs | 6 +- src/intermediate/superscript.rs | 6 +- src/intermediate/table.rs | 6 +- src/intermediate/target.rs | 6 +- src/intermediate/timestamp.rs | 6 +- src/intermediate/underline.rs | 6 +- src/intermediate/verbatim.rs | 6 +- src/intermediate/verse_block.rs | 6 +- 60 files changed, 266 insertions(+), 249 deletions(-) diff --git a/src/intermediate/angle_link.rs b/src/intermediate/angle_link.rs index 5cd2cd1..a92e3a7 100644 --- a/src/intermediate/angle_link.rs +++ b/src/intermediate/angle_link.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IAngleLink {} impl IAngleLink { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::AngleLink<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::AngleLink<'parse>, ) -> Result { Ok(IAngleLink {}) } diff --git a/src/intermediate/ast_node.rs b/src/intermediate/ast_node.rs index da23f24..82bd540 100644 --- a/src/intermediate/ast_node.rs +++ b/src/intermediate/ast_node.rs @@ -112,20 +112,23 @@ pub(crate) enum IAstNode { Timestamp(ITimestamp), } -trait IntoIAstNode<'intermediate, 'parse> { - fn new<'b>( - &'intermediate self, - registry: &'b mut Registry<'intermediate, 'parse>, - ) -> BoxFuture<'b, Result>; +pub(crate) trait IntoIAstNode { + fn into_ast_node<'parse, 'b>( + &'b self, + registry: &'b mut Registry<'parse>, + ) -> BoxFuture<'b, Result> + where + Self: 'parse; } -impl<'intermediate, 'parse> IntoIAstNode<'intermediate, 'parse> - for organic::types::DocumentElement<'parse> -{ - fn new<'b>( - &'intermediate self, - registry: &'b mut Registry<'intermediate, 'parse>, - ) -> BoxFuture<'b, Result> { +impl IntoIAstNode for organic::types::DocumentElement<'_> { + fn into_ast_node<'parse, 'b>( + &'b self, + registry: &'b mut Registry<'parse>, + ) -> BoxFuture<'b, Result> + where + Self: 'parse, + { async move { match self { organic::types::DocumentElement::Heading(inner) => { @@ -140,13 +143,14 @@ impl<'intermediate, 'parse> IntoIAstNode<'intermediate, 'parse> } } -impl<'intermediate, 'parse> IntoIAstNode<'intermediate, 'parse> - for organic::types::Element<'parse> -{ - fn new<'b>( - &'intermediate self, - registry: &'b mut Registry<'intermediate, 'parse>, - ) -> BoxFuture<'b, Result> { +impl IntoIAstNode for organic::types::Element<'_> { + fn into_ast_node<'parse, 'b>( + &'b self, + registry: &'b mut Registry<'parse>, + ) -> BoxFuture<'b, Result> + where + Self: 'parse, + { async move { match self { organic::types::Element::Paragraph(inner) => { @@ -227,11 +231,14 @@ impl<'intermediate, 'parse> IntoIAstNode<'intermediate, 'parse> } } -impl<'intermediate, 'parse> IntoIAstNode<'intermediate, 'parse> for organic::types::Object<'parse> { - fn new<'b>( - &'intermediate self, - registry: &'b mut Registry<'intermediate, 'parse>, - ) -> BoxFuture<'b, Result> { +impl IntoIAstNode for organic::types::Object<'_> { + fn into_ast_node<'parse, 'b>( + &'b self, + registry: &'b mut Registry<'parse>, + ) -> BoxFuture<'b, Result> + where + Self: 'parse, + { async move { match self { organic::types::Object::Bold(inner) => { diff --git a/src/intermediate/babel_call.rs b/src/intermediate/babel_call.rs index 6414178..8e92165 100644 --- a/src/intermediate/babel_call.rs +++ b/src/intermediate/babel_call.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IBabelCall {} impl IBabelCall { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::BabelCall<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::BabelCall<'parse>, ) -> Result { Ok(IBabelCall {}) } diff --git a/src/intermediate/bold.rs b/src/intermediate/bold.rs index d6dc019..3d94ae7 100644 --- a/src/intermediate/bold.rs +++ b/src/intermediate/bold.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IBold {} impl IBold { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Bold<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Bold<'parse>, ) -> Result { Ok(IBold {}) } diff --git a/src/intermediate/center_block.rs b/src/intermediate/center_block.rs index 4f104aa..8b95dab 100644 --- a/src/intermediate/center_block.rs +++ b/src/intermediate/center_block.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ICenterBlock {} impl ICenterBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::CenterBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::CenterBlock<'parse>, ) -> Result { Ok(ICenterBlock {}) } diff --git a/src/intermediate/citation.rs b/src/intermediate/citation.rs index 70902b9..e14cffd 100644 --- a/src/intermediate/citation.rs +++ b/src/intermediate/citation.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ICitation {} impl ICitation { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Citation<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Citation<'parse>, ) -> Result { Ok(ICitation {}) } diff --git a/src/intermediate/citation_reference.rs b/src/intermediate/citation_reference.rs index ebcbe70..30e2a77 100644 --- a/src/intermediate/citation_reference.rs +++ b/src/intermediate/citation_reference.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ICitationReference {} impl ICitationReference { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::CitationReference<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::CitationReference<'parse>, ) -> Result { Ok(ICitationReference {}) } diff --git a/src/intermediate/clock.rs b/src/intermediate/clock.rs index 1dddb04..4db4185 100644 --- a/src/intermediate/clock.rs +++ b/src/intermediate/clock.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IClock {} impl IClock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Clock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Clock<'parse>, ) -> Result { Ok(IClock {}) } diff --git a/src/intermediate/code.rs b/src/intermediate/code.rs index e2da068..0eb3a76 100644 --- a/src/intermediate/code.rs +++ b/src/intermediate/code.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ICode {} impl ICode { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Code<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Code<'parse>, ) -> Result { Ok(ICode {}) } diff --git a/src/intermediate/comment.rs b/src/intermediate/comment.rs index d79837a..d54cee7 100644 --- a/src/intermediate/comment.rs +++ b/src/intermediate/comment.rs @@ -7,9 +7,9 @@ use super::registry::Registry; pub(crate) struct IComment {} impl IComment { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - comment: &organic::types::Comment<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + comment: &'b organic::types::Comment<'parse>, ) -> Result { Ok(IComment {}) } diff --git a/src/intermediate/comment_block.rs b/src/intermediate/comment_block.rs index 0e085d8..b2cdc73 100644 --- a/src/intermediate/comment_block.rs +++ b/src/intermediate/comment_block.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ICommentBlock {} impl ICommentBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::CommentBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::CommentBlock<'parse>, ) -> Result { Ok(ICommentBlock {}) } diff --git a/src/intermediate/diary_sexp.rs b/src/intermediate/diary_sexp.rs index 9c66cff..664bdec 100644 --- a/src/intermediate/diary_sexp.rs +++ b/src/intermediate/diary_sexp.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IDiarySexp {} impl IDiarySexp { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::DiarySexp<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::DiarySexp<'parse>, ) -> Result { Ok(IDiarySexp {}) } diff --git a/src/intermediate/document_element.rs b/src/intermediate/document_element.rs index 9f4b488..d348269 100644 --- a/src/intermediate/document_element.rs +++ b/src/intermediate/document_element.rs @@ -12,9 +12,9 @@ pub(crate) enum IDocumentElement { } impl IDocumentElement { - pub(crate) fn new<'intermediate, 'parse, 'b>( - registry: &'b mut Registry<'intermediate, 'parse>, - original: &'intermediate organic::types::DocumentElement<'parse>, + pub(crate) fn new<'parse, 'b>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::DocumentElement<'parse>, ) -> BoxFuture<'b, Result> { async move { match original { diff --git a/src/intermediate/drawer.rs b/src/intermediate/drawer.rs index 0572ae5..506428f 100644 --- a/src/intermediate/drawer.rs +++ b/src/intermediate/drawer.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IDrawer {} impl IDrawer { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Drawer<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Drawer<'parse>, ) -> Result { Ok(IDrawer {}) } diff --git a/src/intermediate/dynamic_block.rs b/src/intermediate/dynamic_block.rs index 4a8180b..6e31c19 100644 --- a/src/intermediate/dynamic_block.rs +++ b/src/intermediate/dynamic_block.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IDynamicBlock {} impl IDynamicBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::DynamicBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::DynamicBlock<'parse>, ) -> Result { Ok(IDynamicBlock {}) } diff --git a/src/intermediate/element.rs b/src/intermediate/element.rs index 1d81943..1fe3360 100644 --- a/src/intermediate/element.rs +++ b/src/intermediate/element.rs @@ -56,9 +56,9 @@ pub(crate) enum IElement { } impl IElement { - pub(crate) fn new<'intermediate, 'parse, 'b>( - registry: &'b mut Registry<'intermediate, 'parse>, - elem: &'intermediate organic::types::Element<'parse>, + pub(crate) fn new<'parse, 'b>( + registry: &'b mut Registry<'parse>, + elem: &'b organic::types::Element<'parse>, ) -> BoxFuture<'b, Result> { async move { match elem { diff --git a/src/intermediate/entity.rs b/src/intermediate/entity.rs index 547ed0e..a2fa594 100644 --- a/src/intermediate/entity.rs +++ b/src/intermediate/entity.rs @@ -8,9 +8,9 @@ pub(crate) struct IEntity { } impl IEntity { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Entity<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Entity<'parse>, ) -> Result { Ok(IEntity { html: original.html.to_owned(), diff --git a/src/intermediate/example_block.rs b/src/intermediate/example_block.rs index 8fda94e..c10c77c 100644 --- a/src/intermediate/example_block.rs +++ b/src/intermediate/example_block.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IExampleBlock {} impl IExampleBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::ExampleBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::ExampleBlock<'parse>, ) -> Result { Ok(IExampleBlock {}) } diff --git a/src/intermediate/export_block.rs b/src/intermediate/export_block.rs index 4915e2d..d9fa9f8 100644 --- a/src/intermediate/export_block.rs +++ b/src/intermediate/export_block.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IExportBlock {} impl IExportBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::ExportBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::ExportBlock<'parse>, ) -> Result { Ok(IExportBlock {}) } diff --git a/src/intermediate/export_snippet.rs b/src/intermediate/export_snippet.rs index ceb30e1..3759564 100644 --- a/src/intermediate/export_snippet.rs +++ b/src/intermediate/export_snippet.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IExportSnippet {} impl IExportSnippet { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::ExportSnippet<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::ExportSnippet<'parse>, ) -> Result { Ok(IExportSnippet {}) } diff --git a/src/intermediate/fixed_width_area.rs b/src/intermediate/fixed_width_area.rs index cc6e769..6147514 100644 --- a/src/intermediate/fixed_width_area.rs +++ b/src/intermediate/fixed_width_area.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IFixedWidthArea {} impl IFixedWidthArea { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::FixedWidthArea<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::FixedWidthArea<'parse>, ) -> Result { Ok(IFixedWidthArea {}) } diff --git a/src/intermediate/footnote_definition.rs b/src/intermediate/footnote_definition.rs index 2f2b645..ea2774a 100644 --- a/src/intermediate/footnote_definition.rs +++ b/src/intermediate/footnote_definition.rs @@ -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 { - 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, ) -> Result { - 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, diff --git a/src/intermediate/footnote_reference.rs b/src/intermediate/footnote_reference.rs index e5686c2..d0ef6bb 100644 --- a/src/intermediate/footnote_reference.rs +++ b/src/intermediate/footnote_reference.rs @@ -9,11 +9,13 @@ pub(crate) struct IFootnoteReference { } impl IFootnoteReference { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &'intermediate organic::types::FootnoteReference<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::FootnoteReference<'parse>, ) -> Result { - let footnote_id = registry.get_footnote_reference_id(original.label, &original.definition); + let footnote_id = registry + .get_footnote_reference_id(original.label, &original.definition) + .await?; Ok(IFootnoteReference { footnote_id, duplicate_offset: 0, // TODO diff --git a/src/intermediate/heading.rs b/src/intermediate/heading.rs index 49e4f0b..2d6bfd9 100644 --- a/src/intermediate/heading.rs +++ b/src/intermediate/heading.rs @@ -12,9 +12,9 @@ pub(crate) struct IHeading { } impl IHeading { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &'intermediate organic::types::Heading<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Heading<'parse>, ) -> Result { let title = { let mut ret = Vec::new(); diff --git a/src/intermediate/horizontal_rule.rs b/src/intermediate/horizontal_rule.rs index 6e8b8e5..ca7b2e5 100644 --- a/src/intermediate/horizontal_rule.rs +++ b/src/intermediate/horizontal_rule.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IHorizontalRule {} impl IHorizontalRule { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::HorizontalRule<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::HorizontalRule<'parse>, ) -> Result { Ok(IHorizontalRule {}) } diff --git a/src/intermediate/inline_babel_call.rs b/src/intermediate/inline_babel_call.rs index 956a5f0..659a7c7 100644 --- a/src/intermediate/inline_babel_call.rs +++ b/src/intermediate/inline_babel_call.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IInlineBabelCall {} impl IInlineBabelCall { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::InlineBabelCall<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::InlineBabelCall<'parse>, ) -> Result { Ok(IInlineBabelCall {}) } diff --git a/src/intermediate/inline_source_block.rs b/src/intermediate/inline_source_block.rs index 48d5bf7..2f798f1 100644 --- a/src/intermediate/inline_source_block.rs +++ b/src/intermediate/inline_source_block.rs @@ -8,9 +8,9 @@ pub(crate) struct IInlineSourceBlock { } impl IInlineSourceBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::InlineSourceBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::InlineSourceBlock<'parse>, ) -> Result { Ok(IInlineSourceBlock { value: original.value.to_owned(), diff --git a/src/intermediate/italic.rs b/src/intermediate/italic.rs index e71048c..91677b8 100644 --- a/src/intermediate/italic.rs +++ b/src/intermediate/italic.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IItalic {} impl IItalic { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Italic<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Italic<'parse>, ) -> Result { Ok(IItalic {}) } diff --git a/src/intermediate/keyword.rs b/src/intermediate/keyword.rs index 8ec3df7..c0d7567 100644 --- a/src/intermediate/keyword.rs +++ b/src/intermediate/keyword.rs @@ -7,9 +7,9 @@ use super::registry::Registry; pub(crate) struct IKeyword {} impl IKeyword { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - keyword: &organic::types::Keyword<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + keyword: &'b organic::types::Keyword<'parse>, ) -> Result { Ok(IKeyword {}) } diff --git a/src/intermediate/latex_environment.rs b/src/intermediate/latex_environment.rs index 1370d48..05d82cb 100644 --- a/src/intermediate/latex_environment.rs +++ b/src/intermediate/latex_environment.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ILatexEnvironment {} impl ILatexEnvironment { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::LatexEnvironment<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::LatexEnvironment<'parse>, ) -> Result { Ok(ILatexEnvironment {}) } diff --git a/src/intermediate/latex_fragment.rs b/src/intermediate/latex_fragment.rs index b1c069a..804985c 100644 --- a/src/intermediate/latex_fragment.rs +++ b/src/intermediate/latex_fragment.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ILatexFragment {} impl ILatexFragment { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::LatexFragment<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::LatexFragment<'parse>, ) -> Result { Ok(ILatexFragment {}) } diff --git a/src/intermediate/line_break.rs b/src/intermediate/line_break.rs index f0869ac..9534d07 100644 --- a/src/intermediate/line_break.rs +++ b/src/intermediate/line_break.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ILineBreak {} impl ILineBreak { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::LineBreak<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::LineBreak<'parse>, ) -> Result { Ok(ILineBreak {}) } diff --git a/src/intermediate/object.rs b/src/intermediate/object.rs index 67dad58..c51584a 100644 --- a/src/intermediate/object.rs +++ b/src/intermediate/object.rs @@ -62,9 +62,9 @@ pub(crate) enum IObject { } impl IObject { - pub(crate) fn new<'intermediate, 'parse, 'b>( - registry: &'b mut Registry<'intermediate, 'parse>, - obj: &'intermediate organic::types::Object<'parse>, + pub(crate) fn new<'parse, 'b>( + registry: &'b mut Registry<'parse>, + obj: &'b organic::types::Object<'parse>, ) -> BoxFuture<'b, Result> { async move { match obj { diff --git a/src/intermediate/org_macro.rs b/src/intermediate/org_macro.rs index 2c0fa4e..f231a38 100644 --- a/src/intermediate/org_macro.rs +++ b/src/intermediate/org_macro.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IOrgMacro {} impl IOrgMacro { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::OrgMacro<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::OrgMacro<'parse>, ) -> Result { Ok(IOrgMacro {}) } diff --git a/src/intermediate/page.rs b/src/intermediate/page.rs index 4b83943..66514e2 100644 --- a/src/intermediate/page.rs +++ b/src/intermediate/page.rs @@ -21,10 +21,10 @@ pub(crate) struct BlogPostPage { } impl BlogPostPage { - pub(crate) async fn new<'intermediate, 'parse, P: Into>( + pub(crate) async fn new<'b, 'parse, P: Into>( path: P, - registry: &mut Registry<'intermediate, 'parse>, - document: &'intermediate organic::types::Document<'parse>, + registry: &'b mut Registry<'parse>, + document: &'b organic::types::Document<'parse>, ) -> Result { let path = path.into(); let mut children = Vec::new(); diff --git a/src/intermediate/paragraph.rs b/src/intermediate/paragraph.rs index 9536190..f41dc70 100644 --- a/src/intermediate/paragraph.rs +++ b/src/intermediate/paragraph.rs @@ -9,9 +9,9 @@ pub(crate) struct IParagraph { } impl IParagraph { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &'intermediate organic::types::Paragraph<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Paragraph<'parse>, ) -> Result { let children = { let mut ret = Vec::new(); diff --git a/src/intermediate/plain_link.rs b/src/intermediate/plain_link.rs index 9c3ec4c..f79d0de 100644 --- a/src/intermediate/plain_link.rs +++ b/src/intermediate/plain_link.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IPlainLink {} impl IPlainLink { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::PlainLink<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::PlainLink<'parse>, ) -> Result { Ok(IPlainLink {}) } diff --git a/src/intermediate/plain_list.rs b/src/intermediate/plain_list.rs index 71ec77e..5b74769 100644 --- a/src/intermediate/plain_list.rs +++ b/src/intermediate/plain_list.rs @@ -10,9 +10,9 @@ pub(crate) struct IPlainList { } impl IPlainList { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &'intermediate organic::types::PlainList<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::PlainList<'parse>, ) -> Result { let children = { let mut ret = Vec::new(); diff --git a/src/intermediate/plain_list_item.rs b/src/intermediate/plain_list_item.rs index 0554db7..b0308fb 100644 --- a/src/intermediate/plain_list_item.rs +++ b/src/intermediate/plain_list_item.rs @@ -11,9 +11,9 @@ pub(crate) struct IPlainListItem { } impl IPlainListItem { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &'intermediate organic::types::PlainListItem<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::PlainListItem<'parse>, ) -> Result { let tag = { let mut ret = Vec::new(); diff --git a/src/intermediate/plain_text.rs b/src/intermediate/plain_text.rs index 3be73ac..c75ae2d 100644 --- a/src/intermediate/plain_text.rs +++ b/src/intermediate/plain_text.rs @@ -9,9 +9,9 @@ pub(crate) struct IPlainText { } impl IPlainText { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - plain_text: &organic::types::PlainText<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + plain_text: &'b organic::types::PlainText<'parse>, ) -> Result { Ok(IPlainText { source: coalesce_whitespace(plain_text.source).into_owned(), diff --git a/src/intermediate/planning.rs b/src/intermediate/planning.rs index 063fb86..f6a689c 100644 --- a/src/intermediate/planning.rs +++ b/src/intermediate/planning.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IPlanning {} impl IPlanning { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Planning<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Planning<'parse>, ) -> Result { Ok(IPlanning {}) } diff --git a/src/intermediate/property_drawer.rs b/src/intermediate/property_drawer.rs index 0bb7e96..70bea94 100644 --- a/src/intermediate/property_drawer.rs +++ b/src/intermediate/property_drawer.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IPropertyDrawer {} impl IPropertyDrawer { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::PropertyDrawer<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::PropertyDrawer<'parse>, ) -> Result { Ok(IPropertyDrawer {}) } diff --git a/src/intermediate/quote_block.rs b/src/intermediate/quote_block.rs index 504cecd..b08429e 100644 --- a/src/intermediate/quote_block.rs +++ b/src/intermediate/quote_block.rs @@ -9,9 +9,9 @@ pub(crate) struct IQuoteBlock { } impl IQuoteBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &'intermediate organic::types::QuoteBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::QuoteBlock<'parse>, ) -> Result { let children = { let mut ret = Vec::new(); diff --git a/src/intermediate/radio_link.rs b/src/intermediate/radio_link.rs index 8303fb4..fff2e36 100644 --- a/src/intermediate/radio_link.rs +++ b/src/intermediate/radio_link.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IRadioLink {} impl IRadioLink { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::RadioLink<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::RadioLink<'parse>, ) -> Result { Ok(IRadioLink {}) } diff --git a/src/intermediate/radio_target.rs b/src/intermediate/radio_target.rs index e89238a..0efcbce 100644 --- a/src/intermediate/radio_target.rs +++ b/src/intermediate/radio_target.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IRadioTarget {} impl IRadioTarget { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::RadioTarget<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::RadioTarget<'parse>, ) -> Result { Ok(IRadioTarget {}) } diff --git a/src/intermediate/registry.rs b/src/intermediate/registry.rs index a2d8d33..da5183b 100644 --- a/src/intermediate/registry.rs +++ b/src/intermediate/registry.rs @@ -1,5 +1,7 @@ use std::collections::HashMap; +use super::ast_node::IntoIAstNode; +use crate::error::CustomError; use organic::types::Element; use organic::types::Object; @@ -7,14 +9,14 @@ use super::ast_node::IAstNode; type IdCounter = u16; -pub(crate) struct Registry<'intermediate, 'parse> { +pub(crate) struct Registry<'parse> { id_counter: IdCounter, targets: HashMap<&'parse str, String>, footnote_ids: Vec<(Option<&'parse str>, Vec)>, } -impl<'intermediate, 'parse> Registry<'intermediate, 'parse> { - pub(crate) fn new() -> Registry<'intermediate, 'parse> { +impl<'parse> Registry<'parse> { + pub(crate) fn new() -> Registry<'parse> { Registry { id_counter: 0, targets: HashMap::new(), @@ -32,16 +34,16 @@ impl<'intermediate, 'parse> Registry<'intermediate, 'parse> { /// Get a 0-indexed ID for a footnote. /// /// This needs to be incremented to be 1-indexed for render. - pub(crate) fn get_footnote_reference_id<'b>( + pub(crate) async fn get_footnote_reference_id<'b>( &'b mut self, label: Option<&'parse str>, - definition: &'intermediate Vec>, - ) -> usize { + definition: &'b Vec>, + ) -> Result { if let None = label { // If it has no label then it must always get a new ID. - self.footnote_ids - .push((None, FootnoteDefinitionContents::FromReference(definition))); - return self.footnote_ids.len() - 1; + let contents = convert_reference_contents(self, definition).await?; + self.footnote_ids.push((None, contents)); + return Ok(self.footnote_ids.len() - 1); } if let Some(existing_id) = self @@ -50,38 +52,65 @@ impl<'intermediate, 'parse> Registry<'intermediate, 'parse> { .position(|(id, _definition)| *id == label) { if !definition.is_empty() { + let contents = convert_reference_contents(self, definition).await?; let entry = self .footnote_ids .get_mut(existing_id) .expect("If-statement proves this to be Some."); - entry.1 = FootnoteDefinitionContents::FromReference(definition); + entry.1 = contents; } - existing_id + Ok(existing_id) } else { - self.footnote_ids - .push((label, FootnoteDefinitionContents::FromReference(definition))); - self.footnote_ids.len() - 1 + let contents = convert_reference_contents(self, definition).await?; + self.footnote_ids.push((label, contents)); + Ok(self.footnote_ids.len() - 1) } } /// Update the definition to a footnote but do not mark it as referenced. - pub(crate) fn register_footnote_definition<'b>( + pub(crate) async fn register_footnote_definition<'b>( &'b mut self, label: &'parse str, - definition: &'intermediate Vec>, - ) { - if let Some((existing_id, existing_definition)) = self + definition: &'b Vec>, + ) -> Result<(), CustomError> { + let contents = convert_definition_contents(self, definition).await?; + if let Some((_existing_id, existing_definition)) = self .footnote_ids .iter_mut() .find(|(id, _definition)| *id == Some(label)) { - *existing_definition = FootnoteDefinitionContents::FromDefinition(definition); + *existing_definition = contents; } + Ok(()) } } -#[derive(Debug)] -pub(crate) enum FootnoteDefinitionContents<'intermediate, 'parse> { - FromReference(&'intermediate Vec>), - FromDefinition(&'intermediate Vec>), +async fn convert_reference_contents<'b, 'parse>( + registry: &'b mut Registry<'parse>, + contents: &'b Vec>, +) -> Result, CustomError> { + let contents = { + let mut ret = Vec::new(); + for obj in contents.iter() { + ret.push(obj.into_ast_node(registry).await?); + } + ret + }; + + Ok(contents) +} + +async fn convert_definition_contents<'b, 'parse>( + registry: &'b mut Registry<'parse>, + contents: &'b Vec>, +) -> Result, CustomError> { + let contents = { + let mut ret = Vec::new(); + for obj in contents.iter() { + ret.push(obj.into_ast_node(registry).await?); + } + ret + }; + + Ok(contents) } diff --git a/src/intermediate/regular_link.rs b/src/intermediate/regular_link.rs index 4c513b9..36ec9ae 100644 --- a/src/intermediate/regular_link.rs +++ b/src/intermediate/regular_link.rs @@ -10,9 +10,9 @@ pub(crate) struct IRegularLink { } impl IRegularLink { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &'intermediate organic::types::RegularLink<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::RegularLink<'parse>, ) -> Result { let children = { let mut ret = Vec::new(); diff --git a/src/intermediate/section.rs b/src/intermediate/section.rs index 9a73485..6642061 100644 --- a/src/intermediate/section.rs +++ b/src/intermediate/section.rs @@ -9,9 +9,9 @@ pub(crate) struct ISection { } impl ISection { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - section: &'intermediate organic::types::Section<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + section: &'b organic::types::Section<'parse>, ) -> Result { let children = { let mut ret = Vec::new(); diff --git a/src/intermediate/special_block.rs b/src/intermediate/special_block.rs index 8e14fc4..b10cff0 100644 --- a/src/intermediate/special_block.rs +++ b/src/intermediate/special_block.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ISpecialBlock {} impl ISpecialBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::SpecialBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::SpecialBlock<'parse>, ) -> Result { Ok(ISpecialBlock {}) } diff --git a/src/intermediate/src_block.rs b/src/intermediate/src_block.rs index 868c653..ddf9534 100644 --- a/src/intermediate/src_block.rs +++ b/src/intermediate/src_block.rs @@ -8,9 +8,9 @@ pub(crate) struct ISrcBlock { } impl ISrcBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::SrcBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::SrcBlock<'parse>, ) -> Result { let lines = original .contents diff --git a/src/intermediate/statistics_cookie.rs b/src/intermediate/statistics_cookie.rs index 455373e..0b0a3db 100644 --- a/src/intermediate/statistics_cookie.rs +++ b/src/intermediate/statistics_cookie.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IStatisticsCookie {} impl IStatisticsCookie { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::StatisticsCookie<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::StatisticsCookie<'parse>, ) -> Result { Ok(IStatisticsCookie {}) } diff --git a/src/intermediate/strike_through.rs b/src/intermediate/strike_through.rs index 5b8c9e3..ca80c17 100644 --- a/src/intermediate/strike_through.rs +++ b/src/intermediate/strike_through.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IStrikeThrough {} impl IStrikeThrough { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::StrikeThrough<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::StrikeThrough<'parse>, ) -> Result { Ok(IStrikeThrough {}) } diff --git a/src/intermediate/subscript.rs b/src/intermediate/subscript.rs index d99fe81..3a79239 100644 --- a/src/intermediate/subscript.rs +++ b/src/intermediate/subscript.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ISubscript {} impl ISubscript { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Subscript<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Subscript<'parse>, ) -> Result { Ok(ISubscript {}) } diff --git a/src/intermediate/superscript.rs b/src/intermediate/superscript.rs index 50b6eca..fef68c1 100644 --- a/src/intermediate/superscript.rs +++ b/src/intermediate/superscript.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ISuperscript {} impl ISuperscript { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Superscript<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Superscript<'parse>, ) -> Result { Ok(ISuperscript {}) } diff --git a/src/intermediate/table.rs b/src/intermediate/table.rs index 2a94c16..43c44f5 100644 --- a/src/intermediate/table.rs +++ b/src/intermediate/table.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ITable {} impl ITable { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Table<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Table<'parse>, ) -> Result { Ok(ITable {}) } diff --git a/src/intermediate/target.rs b/src/intermediate/target.rs index d5cefe6..43013ad 100644 --- a/src/intermediate/target.rs +++ b/src/intermediate/target.rs @@ -10,9 +10,9 @@ pub(crate) struct ITarget { } impl ITarget { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - target: &organic::types::Target<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + target: &'b organic::types::Target<'parse>, ) -> Result { let id = registry.get_target(target.value); Ok(ITarget { diff --git a/src/intermediate/timestamp.rs b/src/intermediate/timestamp.rs index bb4ff38..f6f95f3 100644 --- a/src/intermediate/timestamp.rs +++ b/src/intermediate/timestamp.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct ITimestamp {} impl ITimestamp { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Timestamp<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Timestamp<'parse>, ) -> Result { Ok(ITimestamp {}) } diff --git a/src/intermediate/underline.rs b/src/intermediate/underline.rs index 31a5e28..4c7b5b9 100644 --- a/src/intermediate/underline.rs +++ b/src/intermediate/underline.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IUnderline {} impl IUnderline { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Underline<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Underline<'parse>, ) -> Result { Ok(IUnderline {}) } diff --git a/src/intermediate/verbatim.rs b/src/intermediate/verbatim.rs index e93e015..bddaf37 100644 --- a/src/intermediate/verbatim.rs +++ b/src/intermediate/verbatim.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IVerbatim {} impl IVerbatim { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::Verbatim<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::Verbatim<'parse>, ) -> Result { Ok(IVerbatim {}) } diff --git a/src/intermediate/verse_block.rs b/src/intermediate/verse_block.rs index 9f14fc0..2e725b7 100644 --- a/src/intermediate/verse_block.rs +++ b/src/intermediate/verse_block.rs @@ -6,9 +6,9 @@ use super::registry::Registry; pub(crate) struct IVerseBlock {} impl IVerseBlock { - pub(crate) async fn new<'intermediate, 'parse>( - registry: &mut Registry<'intermediate, 'parse>, - original: &organic::types::VerseBlock<'parse>, + pub(crate) async fn new<'b, 'parse>( + registry: &'b mut Registry<'parse>, + original: &'b organic::types::VerseBlock<'parse>, ) -> Result { Ok(IVerseBlock {}) }