pub struct ErrorHeader {
pub code: u64,
pub message: Option<String>,
}Expand description
ERROR header.
Legal only on the reply half of a bidirectional stream: an ERROR is the alternative to a reply, so it needs no reference to what it answers.
Fields§
§code: u64Raw error code.
message: Option<String>Human-readable detail; never machine-interpreted.
Implementations§
Source§impl ErrorHeader
impl ErrorHeader
Sourcepub fn new(code: ErrorCode) -> ErrorHeader
pub fn new(code: ErrorCode) -> ErrorHeader
Builds a header for a known error code.
Sourcepub fn error_code(&self) -> Option<ErrorCode>
pub fn error_code(&self) -> Option<ErrorCode>
The error code, or None for an unknown one.
Sourcepub fn encode_into(&self, out: &mut Vec<u8>)
pub fn encode_into(&self, out: &mut Vec<u8>)
Appends the encoded header to out, for a send path that reuses a
buffer (B-250). The canonical form has one implementation and this is
it; Self::encode is a wrapper.
Sourcepub fn decode(bytes: &[u8]) -> Result<ErrorHeader, HeaderError>
pub fn decode(bytes: &[u8]) -> Result<ErrorHeader, HeaderError>
Decodes the header.
Trait Implementations§
Source§impl Clone for ErrorHeader
impl Clone for ErrorHeader
Source§impl Debug for ErrorHeader
impl Debug for ErrorHeader
impl Eq for ErrorHeader
Source§impl PartialEq for ErrorHeader
impl PartialEq for ErrorHeader
impl StructuralPartialEq for ErrorHeader
Auto Trait Implementations§
impl Freeze for ErrorHeader
impl RefUnwindSafe for ErrorHeader
impl Send for ErrorHeader
impl Sync for ErrorHeader
impl Unpin for ErrorHeader
impl UnsafeUnpin for ErrorHeader
impl UnwindSafe for ErrorHeader
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