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,7 +1,6 @@
|
||||
use crate::error::CustomError;
|
||||
use crate::intermediate::util::coalesce_whitespace;
|
||||
|
||||
use super::macros::intermediate;
|
||||
use super::registry::Registry;
|
||||
use crate::error::CustomError;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct ITarget {
|
||||
@@ -9,15 +8,10 @@ pub(crate) struct ITarget {
|
||||
value: String,
|
||||
}
|
||||
|
||||
impl ITarget {
|
||||
pub(crate) async fn new<'b, 'parse>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
target: &'b organic::types::Target<'parse>,
|
||||
) -> Result<ITarget, CustomError> {
|
||||
let id = registry.get_target(target.value);
|
||||
Ok(ITarget {
|
||||
id: id.clone(),
|
||||
value: target.value.to_owned(),
|
||||
})
|
||||
}
|
||||
}
|
||||
intermediate!(ITarget, Target, |registry, original| async {
|
||||
let id = registry.get_target(original.value);
|
||||
Ok(ITarget {
|
||||
id: id.clone(),
|
||||
value: original.value.to_owned(),
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user