Peer

Derive Macro Peer 

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

Procedural macro to automatically implement the Peer trait for a struct.

§Requirements

  • The struct must have a field marked with #[peer_ctx] or, if not present, a field named peer_ctx whose type is PeerContext.

§Behavior

  • Implements the peer_context(&self) method, returning a reference to the selected field.

§Usage

#[derive(Peer)]
pub struct MyParty {
    #[peer_ctx]
    peer_ctx: PeerContext,
    // ...
}
// or, fallback to type matching:
#[derive(Peer)]
pub struct MyParty { peer_ctx: PeerContext, ... }