#[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 From<ErrorReplyReason> for ReplyCode
impl From<ErrorReplyReason> for ReplyCode
Source§fn from(original: ErrorReplyReason) -> ReplyCode
fn from(original: ErrorReplyReason) -> ReplyCode
Converts to this type from the input type.
Source§impl From<SuccessReplyReason> for ReplyCode
impl From<SuccessReplyReason> for ReplyCode
Source§fn from(original: SuccessReplyReason) -> ReplyCode
fn from(original: SuccessReplyReason) -> ReplyCode
Converts to this type from the input type.
Source§impl Ord for ReplyCode
impl Ord for ReplyCode
Source§impl PartialOrd for ReplyCode
impl PartialOrd 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