Enum client::protocol::message::MessageType
source · pub enum MessageType {
ERROR,
REQUEST,
RESPONSE,
}
Expand description
The type (action) of a message which is the first two bits of a message.
Bits | Type |
---|---|
00 | Error |
01 | Request |
10 | Response |
Note that 11
is reserved.
Variants§
ERROR
Message type for error,
maps to 0b00
in the first two bits.
REQUEST
Message type for request,
maps to 0b01
in the first two bits.
RESPONSE
Message type for response,
maps to 0b10
in the first two bits.
Implementations§
source§impl MessageType
impl MessageType
sourcefn to_byte(&self) -> u8
fn to_byte(&self) -> u8
Convert a MessageType
to a Byte
as defined in the protocol.
sourcepub fn from_byte(byte: u8) -> Result<MessageType, &'static str>
pub fn from_byte(byte: u8) -> Result<MessageType, &'static str>
Convert a Byte
to a MessageType
as defined in the protocol.
Auto Trait Implementations§
impl RefUnwindSafe for MessageType
impl Send for MessageType
impl Sync for MessageType
impl Unpin for MessageType
impl UnwindSafe for MessageType
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