#[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]) -> ReplyCode
pub fn from_bytes(bytes: [u8; 4]) -> ReplyCode
Parses 4 bytes array to ReplyCode
.
Sourcepub fn error(reason: impl Into<ErrorReplyReason>) -> ReplyCode
pub fn error(reason: impl Into<ErrorReplyReason>) -> ReplyCode
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 Decode for ReplyCode
impl Decode for ReplyCode
Source§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<ReplyCode, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<ReplyCode, Error>where
__CodecInputEdqy: Input,
Attempt to deserialise the value from input.
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl Encode for ReplyCode
impl Encode for ReplyCode
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
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
Source§impl Sequence for ReplyCode
impl Sequence for ReplyCode
impl Copy for ReplyCode
impl EncodeLike 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