Macro dash_sdk::delegate_enum
source ยท macro_rules! delegate_enum { ($request:ident, $response:ident, $object:ty, $(($variant:ident, $req: ty, $resp: ty)),+) => { ... }; }
Expand description
Define enums that will wrap multiple requests/responses for one object.
In order to support multiple request/response types for one object (like, GetIdentityRequest and GetIdentityByPublicKeyHashRequest for Identity), we need to wrap them in an enum and delegate TransportRequest and FromProof to the appropriate variant.
This macro creates enums for requests ($request
) and responses ($response
) and variants ($variant
) for
each request ($req
) /response ($req
) pair. Variant name in request and response enums are the same.
It also calls delegate_transport_request_variant! and delegate_from_proof_variant! to delegate TransportRequest and FromProof traits to the appropriate variant.