protocol

Attribute Macro protocol 

Source
#[protocol]
Expand description

Modifies the enum to implement protocol:

ยงUsage

โ“˜
#[protocol]
enum MyProtocol {
    MessageOne(Msg),
    MessageTwo(Request)
}

Creates the following enum:

โ“˜
enum MyProtocol {
    MessageOne(Msg),
    MessageTwo((Request, Tx<T>))
}

And also generates the following implementations:

โ“˜
impl Protocol for MyProtocol { ... }
impl Accept<OneOffMsg> for MyProtocol { ... }
impl Accept<MessageWithRequest> for MyProtocol { ... }
impl<H: Handler> HandledBy<H> for MyProtocol
where 
    H: HandleMessage<OneOffMsg> + HandleMessage<MessageWithRequest>
{ ... }