macro_rules! trg_new_trigger_func {
($func_name:ident, $arg_name:ident, $body:block) => { ... };
}Expand description
This macro generates a function that takes a reference to a Box<dyn Any>
as an argument and returns a bool. The function body ($body) determines
whether the condition is met.
§Usage
Use for defining functions required to create a Trigger object.
§Example
// Define a trigger function that print the argument than evaluate whether the argument is 5
tui_trg_new_trigger_func!(function_name, argument_name, {
let number = *argument_name.downcast_ref::<u32>().unwrap();
println!("{}", number);
return number == 5;
});