Use macros for creating the intermediate stage.
This is to make it easier to change function signatures by consolidating the places where the signatures exist.
This commit is contained in:
@@ -1,24 +1,21 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::ast_node::IAstNode;
|
||||
use super::macros::intermediate;
|
||||
use super::registry::Registry;
|
||||
use super::IElement;
|
||||
use super::IObject;
|
||||
use super::IAstNode;
|
||||
use crate::error::CustomError;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct IFootnoteDefinition {}
|
||||
|
||||
impl IFootnoteDefinition {
|
||||
pub(crate) async fn new<'b, 'parse>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
original: &'b organic::types::FootnoteDefinition<'parse>,
|
||||
) -> Result<IFootnoteDefinition, CustomError> {
|
||||
intermediate!(
|
||||
IFootnoteDefinition,
|
||||
FootnoteDefinition,
|
||||
|registry, original| async {
|
||||
registry
|
||||
.register_footnote_definition(original.label, &original.children)
|
||||
.await?;
|
||||
Ok(IFootnoteDefinition {})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct IRealFootnoteDefinition {
|
||||
@@ -27,8 +24,8 @@ pub(crate) struct IRealFootnoteDefinition {
|
||||
}
|
||||
|
||||
impl IRealFootnoteDefinition {
|
||||
pub(crate) async fn new<'b, 'parse>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
pub(crate) async fn new<'reg, 'orig, 'parse>(
|
||||
registry: &'reg mut Registry<'orig, 'parse>,
|
||||
footnote_id: usize,
|
||||
contents: Vec<IAstNode>,
|
||||
) -> Result<IRealFootnoteDefinition, CustomError> {
|
||||
|
||||
Reference in New Issue
Block a user