pub struct Envelope {
pub status: i32,
pub meta: Vec<(String, String)>,
pub payload: Vec<u8>,
}Expand description
A decoded (or to-be-encoded) bridge envelope.
Fields§
§status: i32Non-negative: the call’s status (HTTP status, a handle, …). Negative: an error
sentinel; meta is empty and Envelope::error_message holds the text.
meta: Vec<(String, String)>Key/value pairs (response headers, attributes); empty for error envelopes.
payload: Vec<u8>The body / result bytes (for errors, the raw message bytes).
Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn decode(bytes: &[u8]) -> Result<Envelope, &'static str>
pub fn decode(bytes: &[u8]) -> Result<Envelope, &'static str>
Parse the wire layout. Err is a malformed envelope (truncated), not a sentinel:
sentinel statuses parse fine and are the caller’s to interpret.
§Errors
Returns an error when bytes is shorter than the 8-byte header or than the
meta length the header declares.
Sourcepub fn error_message(&self) -> String
pub fn error_message(&self) -> String
For a sentinel (negative-status) envelope: the error message text.
Trait Implementations§
impl StructuralPartialEq for Envelope
Auto Trait Implementations§
impl Forget for Envelope
impl Freeze for Envelope
impl Move for Envelope
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnsafeUnpin for Envelope
impl UnwindSafe for Envelope
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