Skip to main content

Interface

Derive Macro Interface 

Source
#[derive(Interface)]
{
    // Attributes available to this derive:
    #[zestors]
}
Expand description

Derives the Interface trait for an enum: the set of messages an actor accepts.

Every variant must be a tuple variant holding exactly one Envelope<M>, with each message type M appearing once; anything else is rejected. Generic enums aren’t supported. Besides Interface, it generates the conversions between each Envelope<M> and the enum.

§Example

#[derive(Interface)]
enum MyInterface {
    MessageA(Envelope<u32>),
    MessageB(Envelope<String>),
}