#[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 namedpeer_ctxwhose 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, ... }