Skip to content

Struct envelope::CommandEnvelope

zaun_community_protocol::envelope::CommandEnvelope · Struct

pub struct CommandEnvelope { … }

{ "v", "type", "request_id", "community_id", "channel_id"?, "body" }.

Parse received text with super::parse_command; serialise with serde (client side). body is the command’s body object exactly as received, for the command module to parse by type and for the idempotency hash.

Envelope version.

Command name.

Correlation id; None (null) only for signal.* commands.

The bound community, or the target of community.create / invite.redeem; else null.

Present for channel-scoped commands.

The body object, {} when empty.

pub fn new<impl Into<String>>(kind: impl Into<String>, request_id: Option<RequestId>, community_id: Option<CommunityId>, channel_id: Option<ChannelId>, body: Box<RawValue>) -> Self

A command at PROTOCOL_VERSION.

pub fn is_signal(&self) -> bool

Whether this is an ephemeral signal (signal.*): no response, no idempotency record.

pub fn is_mutating(&self) -> bool

Whether the command is mutating, hence idempotency-recorded.

pub fn body_hash(&self) -> BodyHash

SHA3-256 of the body JSON text as received.

Clone, Debug, Serialize

Full rustdoc page