macro_rules! callback {
($callback_name:ident(($($var:ident : $typ:ty),+)) -> $action_ty:ty $body:block) => { ... };
($callback_name:ident($var:ident : $typ:ty) -> $action_ty:ty $body:block) => { ... };
}Expand description
Creates a callback instance. Must accept a single argument, so ()
should be used when no arguments are needed and tuples where
more than one value need to be passed.
§Example
ⓘ
callback!(task_done_callback(result: String) -> Action {
SomeAction { result }
})
callback!(multiple_arguments_callback((arg1: u64, arg2: u64)) -> Action {
MultipleArgumentsAction { value: arg1 + arg2 }
})