pub struct AppErrorPayload<'a> {
pub code: u16,
pub message: &'a str,
}Expand description
Payload carried inside a Response when status == ResponseStatus::AppError.
Encoded as postcard (varint(code), varint(len), len-bytes UTF-8 message).
Borrows the message slice from the receive buffer for zero-copy decode on
targets that cannot allocate.
§Wire layout
| Field | Type | Encoding |
|---|---|---|
code | u16 | postcard varint (1–3 bytes) |
message | &str | postcard varint(len) + UTF-8 bytes |
The code namespace is application-defined. Reserve 0 as a catch-all
“unspecified application error” when no finer classification is needed.
Fields§
§code: u16Application-defined error code.
message: &'a strHuman-readable error message, borrowed from the receive buffer.
Trait Implementations§
Source§impl<'a> Clone for AppErrorPayload<'a>
impl<'a> Clone for AppErrorPayload<'a>
Source§fn clone(&self) -> AppErrorPayload<'a>
fn clone(&self) -> AppErrorPayload<'a>
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<'a> Debug for AppErrorPayload<'a>
impl<'a> Debug for AppErrorPayload<'a>
Source§impl<'de: 'a, 'a> Deserialize<'de> for AppErrorPayload<'a>
impl<'de: 'a, 'a> Deserialize<'de> for AppErrorPayload<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> PartialEq for AppErrorPayload<'a>
impl<'a> PartialEq for AppErrorPayload<'a>
Source§fn eq(&self, other: &AppErrorPayload<'a>) -> bool
fn eq(&self, other: &AppErrorPayload<'a>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<'a> Serialize for AppErrorPayload<'a>
impl<'a> Serialize for AppErrorPayload<'a>
impl<'a> Eq for AppErrorPayload<'a>
impl<'a> StructuralPartialEq for AppErrorPayload<'a>
Auto Trait Implementations§
impl<'a> Freeze for AppErrorPayload<'a>
impl<'a> RefUnwindSafe for AppErrorPayload<'a>
impl<'a> Send for AppErrorPayload<'a>
impl<'a> Sync for AppErrorPayload<'a>
impl<'a> Unpin for AppErrorPayload<'a>
impl<'a> UnsafeUnpin for AppErrorPayload<'a>
impl<'a> UnwindSafe for AppErrorPayload<'a>
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