macro_rules! payload_convert { ($service_payload_type:ident, $payload_type:ty) => { ... }; }
Expand description
The payload_convert macro helps convert between the domain-specific payloads
(variants of Payload
) and the Payload
container(to/from) & MessageHub
MessageEvent (from). The first matcher is the Payload
variant name where
the payload type can be found. Note that this is the direct variant name
and not fully qualified. The second matcher is the domain-specific payload
type.
The macro implements the following in a mod called convert:
- Into from domain Payload to service MessageHub Payload
- TryFrom from service MessageHub Payload to domain Payload
- TryFromWithClient from service MessageHub MessageEvent to domain Payload and client.
- TryFromWithClient from a service MessageHub MessageEvent option to domain Payload and client.