Enum jcm::MessageType
source · #[repr(u8)]pub enum MessageType {
Request(RequestType),
Event(EventType),
Reserved = 255,
}Expand description
Represents the message type.
Variants§
Request(RequestType)
Host-to-device request message.
Event(EventType)
Device-to-host status event.
Reserved = 255
Reserved message type.
Implementations§
source§impl MessageType
impl MessageType
sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new MessageType.
sourcepub const fn from_u8(val: u8) -> Self
pub const fn from_u8(val: u8) -> Self
Infallible conversion from a u8 into a RequestType.
sourcepub const fn to_u8(&self) -> u8
pub const fn to_u8(&self) -> u8
Converts the MessageType to a u8.
sourcepub const fn len() -> usize
pub const fn len() -> usize
Gets the length of the MessageType.
sourcepub const fn request_type(&self) -> Result<RequestType>
pub const fn request_type(&self) -> Result<RequestType>
Attempts to get the MessageType as a RequestType.
sourcepub const fn event_type(&self) -> Result<EventType>
pub const fn event_type(&self) -> Result<EventType>
Attempts to get the MessageType as a EventType.
pub const fn is_request(&self) -> bool
pub const fn is_event(&self) -> bool
sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Gets whether the MessageType contains a reserved variant.
Trait Implementations§
source§impl Clone for MessageType
impl Clone for MessageType
source§fn clone(&self) -> MessageType
fn clone(&self) -> MessageType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for MessageType
impl Debug for MessageType
source§impl Default for MessageType
impl Default for MessageType
source§impl Display for MessageType
impl Display for MessageType
source§impl From<&MessageType> for u8
impl From<&MessageType> for u8
source§fn from(val: &MessageType) -> Self
fn from(val: &MessageType) -> Self
Converts to this type from the input type.
source§impl From<MessageType> for u8
impl From<MessageType> for u8
source§fn from(val: MessageType) -> Self
fn from(val: MessageType) -> Self
Converts to this type from the input type.
source§impl PartialEq for MessageType
impl PartialEq for MessageType
source§fn eq(&self, other: &MessageType) -> bool
fn eq(&self, other: &MessageType) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl TryFrom<u8> for MessageType
impl TryFrom<u8> for MessageType
impl Copy for MessageType
impl Eq for MessageType
impl StructuralPartialEq for MessageType
Auto Trait Implementations§
impl Freeze for MessageType
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