macro_rules! composite_custom_message_handler {
(
$handler_visibility:vis struct $handler:ident {
$($field_visibility:vis $field:ident: $type:ty),* $(,)*
}
$message_visibility:vis enum $message:ident {
$($variant:ident($pattern:pat)),* $(,)*
}
) => { ... };
}
Expand description
Defines a composite type implementing CustomMessageHandler
(and therefore also implementing
CustomMessageReader
), along with a corresponding enumerated custom message Type
, from
one or more previously defined custom message handlers.
Useful for parameterizing PeerManager
with custom message handling for one or more sets of
custom messages. Message type ids may be given as a valid match
pattern, including ranges,
though using OR-ed literal patterns is preferred in order to catch unreachable code for
conflicting handlers.
See crate documentation for example usage.