macro_rules! processor_pipeline {
($struct_name:ident, $type:ty, $($processor:ty),+) => { ... };
}Expand description
Creates a stateless pipeline of processors.
This macro generates a struct that chains multiple Processor implementations
together into a single pipeline. The data flows through each processor in the
order they are specified.
§Parameters
$struct_name: The name for the new pipeline struct.$type: The type of data the pipeline will operate on.$($processor: ty),+: A comma-separated list of processor types that implementProcessor<$type>.
§Examples
use type_flow_macros::{processor, processor_pipeline};
use type_flow_traits::Processor;
processor!(AddOne, i32, |x| x + 1);
processor!(MulTwo, i32, |x| x * 2);
processor_pipeline!(MyPipeline, i32, AddOne, MulTwo);
let result = MyPipeline::process(10);
assert_eq!(result, 22); // (10 + 1) * 2