Type Definition rad::MacroType [−][src]
pub type MacroType = fn(_: &str, _: bool, _: &mut Processor) -> Result<Option<String>, RadError>;Expand description
Type signature of basic macros
This is in order of args, greediness, processor’s mutable reference
Example
fn demo(args: &str, greedy: bool, processor: &mut Processor) -> Result<Option<String>, RadError> {
let mut medium = String::new();
// Some logics go here
if this_macro_prints_something {
Ok(Some(medium))
} else {
// If return "None", then single newline will be removed
Ok(None)
}
}
// ... While building a processor ...
processor.add_basic_rules(vec![("test", test as MacroType)]);