pub struct ErrorCode { /* private fields */ }
Expand description
The ErrorCode
contains a numeric error code value in the range of 300
to 699 plus a textual reason phrase encoded in UTF-8
RFC3629
; it is also
consistent in its code assignments and semantics with SIP
RFC3261
and HTTP RFC7231
.
The reason phrase is meant for diagnostic purposes and can be anything
appropriate for the error code.
Recommended reason phrases for the defined error codes are included
in the IANA
registry for error codes. The reason phrase MUST be a
UTF-8-encoded RFC3629
sequence of fewer than 128 characters (which can be as long as 509 bytes
when encoding them or 763 bytes when decoding them).
§Examples
let attr = ErrorCode::new(420, "Unknown Attribute")?;
assert_eq!(attr.class(), 4);
assert_eq!(attr.number(), 20);
assert_eq!(attr.error_code(), 420);
assert_eq!(attr.reason(), "Unknown Attribute");
Implementations§
Trait Implementations§
source§impl From<ErrorCode> for ErrorCode
impl From<ErrorCode> for ErrorCode
source§fn from(error: ErrorCodeType) -> Self
fn from(error: ErrorCodeType) -> Self
Converts to this type from the input type.
impl Eq for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnwindSafe for ErrorCode
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)