Macro cbk_new_callback_func

Source
macro_rules! cbk_new_callback_func {
    ($func_name:ident, $arg_name:ident, $body:block) => { ... };
}
Expand description

This macro generates a function that take a reference to a Box<dyn Any> as an argument and return nothing. The function body ($body) is the code that will be execute when the callback is trigger.

§Usage

Use for defining functions required to create a Callback object,

§Example

use feather_tui as tui;
 
// Define a callback function that print out the argument that is was given
tui::tui_cbk_new_callback_func!(function_name, argument_name, {
    println!(
        "Callback received: {}",
        argument_name.downcast_ref::<u32>().unwrap());
});