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,22 +1,17 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::macros::intermediate;
|
||||
use super::registry::Registry;
|
||||
use crate::error::CustomError;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct ISrcBlock {
|
||||
pub(crate) lines: Vec<String>,
|
||||
}
|
||||
|
||||
impl ISrcBlock {
|
||||
pub(crate) async fn new<'b, 'parse>(
|
||||
registry: &'b mut Registry<'parse>,
|
||||
original: &'b organic::types::SrcBlock<'parse>,
|
||||
) -> Result<ISrcBlock, CustomError> {
|
||||
let lines = original
|
||||
.contents
|
||||
.split_inclusive('\n')
|
||||
.map(|s| s.to_owned())
|
||||
.collect();
|
||||
Ok(ISrcBlock { lines })
|
||||
}
|
||||
}
|
||||
intermediate!(ISrcBlock, SrcBlock, |registry, original| async {
|
||||
let lines = original
|
||||
.contents
|
||||
.split_inclusive('\n')
|
||||
.map(|s| s.to_owned())
|
||||
.collect();
|
||||
Ok(ISrcBlock { lines })
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user