pub struct CommandEnvelope {
pub v: u16,
pub kind: String,
pub request_id: Option<RequestId>,
pub community_id: Option<CommunityId>,
pub channel_id: Option<ChannelId>,
pub body: Box<RawValue>,
}Expand description
{ "v", "type", "request_id", "community_id", "channel_id"?, "body" } (§7.1).
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 (§7.3).
Fields§
§v: u16Envelope version.
kind: StringCommand name (§8).
request_id: Option<RequestId>Correlation id; None (null) only for signal.* commands.
community_id: Option<CommunityId>The bound community, or the target of community.create / invite.redeem; else null.
channel_id: Option<ChannelId>Present for channel-scoped commands.
body: Box<RawValue>The body object, {} when empty.
Implementations§
Source§impl CommandEnvelope
impl CommandEnvelope
Sourcepub fn new(
kind: impl Into<String>,
request_id: Option<RequestId>,
community_id: Option<CommunityId>,
channel_id: Option<ChannelId>,
body: Box<RawValue>,
) -> Self
pub fn new( 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.
Sourcepub fn is_signal(&self) -> bool
pub fn is_signal(&self) -> bool
Whether this is an ephemeral signal (signal.*): no response, no idempotency record.
Sourcepub fn is_mutating(&self) -> bool
pub fn is_mutating(&self) -> bool
Whether the command is mutating, hence idempotency-recorded (§7.3).
Trait Implementations§
Source§impl Clone for CommandEnvelope
impl Clone for CommandEnvelope
Source§fn clone(&self) -> CommandEnvelope
fn clone(&self) -> CommandEnvelope
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandEnvelope
impl Debug for CommandEnvelope
Auto Trait Implementations§
impl Freeze for CommandEnvelope
impl RefUnwindSafe for CommandEnvelope
impl Send for CommandEnvelope
impl Sync for CommandEnvelope
impl Unpin for CommandEnvelope
impl UnsafeUnpin for CommandEnvelope
impl UnwindSafe for CommandEnvelope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more