macro_rules! processor {
($struct_name:ident, $type:ty, $process_fn:expr) => { ... };
}Expand description
Creates a stateless, data-transforming processor struct.
This macro generates a struct that implements the Processor<T> trait,
taking data of a specific type, processing it with a given function,
and returning data of the same type.
§Parameters
$struct_name: The name for the new processor struct.$type: The type of data the processor will operate on.$process_fn: A function or closure that takes a value of$typeand returns a new value of$type.
§Examples
use type_flow_macros::processor;
use type_flow_traits::Processor;
fn to_uppercase(s: String) -> String {
s.to_uppercase()
}
processor!(UppercaseProcessor, String, to_uppercase);
let processed = UppercaseProcessor::process("hello".to_string());
assert_eq!(processed, "HELLO");