#[repr(u16)]pub enum MessageCode {
Request(RequestCode),
Event(EventCode),
Reserved = 65_535,
}Variants§
Implementations§
Source§impl MessageCode
impl MessageCode
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new MessageCode.
Sourcepub const fn create(msg_type: MessageType, val: u16) -> Self
pub const fn create(msg_type: MessageType, val: u16) -> Self
Creates a new MessageCode from the provided parameters.
Sourcepub const fn is_request_code(&self) -> bool
pub const fn is_request_code(&self) -> bool
Gets whether the MessageCode contains a RequestCode variant.
Sourcepub const fn request_code(&self) -> Result<RequestCode>
pub const fn request_code(&self) -> Result<RequestCode>
Converts the MessageCode into a RequestCode.
Sourcepub const fn is_event_code(&self) -> bool
pub const fn is_event_code(&self) -> bool
Gets whether the MessageCode contains a EventCode variant.
Sourcepub const fn is_power_up_event(&self) -> bool
pub const fn is_power_up_event(&self) -> bool
Gets whether the MessageCode contains a PowerUp EventCode variant.
Sourcepub const fn event_code(&self) -> Result<EventCode>
pub const fn event_code(&self) -> Result<EventCode>
Converts the MessageCode into a EventCode.
Sourcepub const fn func_id(&self) -> FuncId
pub const fn func_id(&self) -> FuncId
Gets the FuncId of the MessageCode.
Sourcepub fn to_bytes(&self) -> [u8; 2]
pub fn to_bytes(&self) -> [u8; 2]
Converts the MessageCode to raw byte array.
Sourcepub const fn len() -> usize
pub const fn len() -> usize
Gets the length of the MessageCode.
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Gets whether the MessageCode contains a reserved variant.
Sourcepub const fn is_valid(&self) -> bool
pub const fn is_valid(&self) -> bool
Gets whether the MessageCode is a valid variant.
Trait Implementations§
Source§impl Clone for MessageCode
impl Clone for MessageCode
Source§fn clone(&self) -> MessageCode
fn clone(&self) -> MessageCode
Returns a duplicate 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 MessageCode
impl Debug for MessageCode
Source§impl Default for MessageCode
impl Default for MessageCode
Source§impl Display for MessageCode
impl Display for MessageCode
Source§impl From<&MessageCode> for u16
impl From<&MessageCode> for u16
Source§fn from(val: &MessageCode) -> Self
fn from(val: &MessageCode) -> Self
Converts to this type from the input type.
Source§impl From<&MessageCode> for u8
impl From<&MessageCode> for u8
Source§fn from(val: &MessageCode) -> Self
fn from(val: &MessageCode) -> Self
Converts to this type from the input type.
Source§impl From<MessageCode> for u16
impl From<MessageCode> for u16
Source§fn from(val: MessageCode) -> Self
fn from(val: MessageCode) -> Self
Converts to this type from the input type.
Source§impl From<MessageCode> for u8
impl From<MessageCode> for u8
Source§fn from(val: MessageCode) -> Self
fn from(val: MessageCode) -> Self
Converts to this type from the input type.
Source§impl PartialEq for MessageCode
impl PartialEq for MessageCode
Source§impl TryFrom<&MessageCode> for CollectMode
impl TryFrom<&MessageCode> for CollectMode
Source§impl TryFrom<MessageCode> for CollectMode
impl TryFrom<MessageCode> for CollectMode
impl Copy for MessageCode
impl Eq for MessageCode
impl StructuralPartialEq for MessageCode
Auto Trait Implementations§
impl Freeze for MessageCode
impl RefUnwindSafe for MessageCode
impl Send for MessageCode
impl Sync for MessageCode
impl Unpin for MessageCode
impl UnwindSafe for MessageCode
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