#[repr(u8)]pub enum ReplyCode {
Success(SuccessReplyReason),
Error(ErrorReplyReason),
Unsupported = 255,
}
Expand description
Enum representing reply code with reason of its creation.
Variants§
Success(SuccessReplyReason)
Success reply.
Error(ErrorReplyReason)
Error reply.
Unsupported = 255
Unsupported code. Variant exists for backward compatibility.
Implementations§
Source§impl ReplyCode
impl ReplyCode
Sourcepub fn from_bytes(bytes: [u8; 4]) -> Self
pub fn from_bytes(bytes: [u8; 4]) -> Self
Parses 4 bytes array to ReplyCode
.
Sourcepub fn error(reason: impl Into<ErrorReplyReason>) -> Self
pub fn error(reason: impl Into<ErrorReplyReason>) -> Self
Constructs ReplyCode::Error(_)
variant from underlying reason.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Returns bool, defining if ReplyCode
represents success reply.
Sourcepub fn is_unsupported(&self) -> bool
pub fn is_unsupported(&self) -> bool
Returns bool, defining if ReplyCode
represents unsupported reason.
Trait Implementations§
Source§impl Error for ReplyCode
impl Error for ReplyCode
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<ErrorReplyReason> for ReplyCode
impl From<ErrorReplyReason> for ReplyCode
Source§fn from(source: ErrorReplyReason) -> Self
fn from(source: ErrorReplyReason) -> Self
Converts to this type from the input type.
Source§impl From<SuccessReplyReason> for ReplyCode
impl From<SuccessReplyReason> for ReplyCode
Source§fn from(source: SuccessReplyReason) -> Self
fn from(source: SuccessReplyReason) -> Self
Converts to this type from the input type.
Source§impl Sequence for ReplyCode
impl Sequence for ReplyCode
impl Copy for ReplyCode
impl Eq for ReplyCode
impl StructuralPartialEq for ReplyCode
Auto Trait Implementations§
impl Freeze for ReplyCode
impl RefUnwindSafe for ReplyCode
impl Send for ReplyCode
impl Sync for ReplyCode
impl Unpin for ReplyCode
impl UnwindSafe for ReplyCode
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