macro_rules! handle_multi_actions {
    ($actions:expr, $handler_func:expr, $error_msg:expr) => { ... };
}
Expand description

This accept a action instance, handler_func and error_msg string as parameter. This macro is used for handling PeerRingAction::MultiActions.

It accepts three parameters:

  • $actions: This parameter represents the actions that will be processed.

  • $handler_func: This is the handler function that will be used to process each action. It is expected to be an expression that evaluates to a closure. The closure should be an asynchronous function which accepts a single action and returns a Result<MessageHandlerEvent>. The function will be called for each action in $actions, and should handle the action appropriately.

  • $error_msg: This is a string that will be used as the error message if the handler function returns an error. The string should include one set of braces {} that will be filled with the Debug representation of the error returned from the handler function.

The macro returns a Result<Vec<MessageHandlerEvent>>. If all actions are processed successfully, it returns Ok(Vec<MessageHandlerEvent>), where the vector includes all the successful results from the handler function. If any action fails, an error message will be logged, but the error will not be returned from the macro; instead, it will continue with the next action.

The macro is asynchronous, so it should be used within an async context.