#[derive(Party)]
{
// Attributes available to this derive:
#[party]
#[session_id]
#[transcript]
#[hasher]
}
Expand description
Procedural macro to automatically implement the Party trait for a struct.
§Requirements
- The struct must have either:
- A field marked with
#[session_id]or a field of typeSessionId, or - At least one field annotated with
#[party](which must itself implementParty).
- A field marked with
§Behavior
session_id(): Returns a reference to theSessionIdfield, or delegates to the first#[party]field.protocol_name(): Uses thePROTOCOL_INFOconstant if a directSessionIdfield is present, otherwise formats as"<TypeName> - <InnerProtocolName>".refresh(): Callsrefresh_fromorrefresh_withon the session id, andrefresh()on all#[party]fields. If ahasherfield is present, it is reset.
§Usage
#[derive(Party)]
pub struct MyParty {
#[session_id]
session_id: SessionId,
#[party]
inner: InnerPartyType,
// ...
}
// or, with type/name matching fallback:
#[derive(Party)]
pub struct MyParty { session_id: SessionId, #[party] inner: InnerPartyType, ... }