Struct envelope::ResponseEnvelope
zaun_community_protocol::envelope::ResponseEnvelope · Struct
pub struct ResponseEnvelope { … }{ "v", "type": "response", "request_id", "ok", "body" | "error" }.
request_id is null when the command’s id could not be read.
Fields
Section titled “Fields”v: u16
Section titled “v: u16”Envelope version.
request_id: Option<RequestId>
Section titled “request_id: Option<RequestId>”The command’s request_id, or None (null).
outcome: Outcome
Section titled “outcome: Outcome”Success body or error.
Methods
Section titled “Methods”pub fn ok(request_id: RequestId, body: Box<RawValue>) -> SelfA success response at PROTOCOL_VERSION.
ok_json
Section titled “ok_json”pub fn ok_json<T>(request_id: RequestId, body: &T) -> Result<Self>A success response whose body is serialised from body.
Errors
Section titled “Errors”body fails to serialise as JSON.
pub fn error(request_id: Option<RequestId>, error: ErrorBody) -> SelfAn error response at PROTOCOL_VERSION.
error_body
Section titled “error_body”pub fn error_body(&self) -> Option<&ErrorBody>The error, if this is a failure.
is_recorded
Section titled “is_recorded”pub fn is_recorded(&self) -> boolWhether this response is stored as the idempotency record: every success and
every error except BUSY, RATE_LIMITED, INTERNAL and SLOWMODE_ACTIVE.
Trait implementations
Section titled “Trait implementations”Clone, Debug, Deserialize<'de>, Serialize