pub struct Mhdr(pub u8);Expand description
MHDR byte: 3 bits MType, 3 bits RFU, 2 bits Major.
Wraps the leading byte of every PHYPayload. Build with
Mhdr::from_parts or wrap an existing byte with Mhdr::new.
§Examples
use lora_packet::{Mhdr, MType};
let m = Mhdr::from_parts(MType::UnconfirmedDataUp, 0);
assert_eq!(m.as_byte(), 0x40);
assert_eq!(m.m_type().unwrap(), MType::UnconfirmedDataUp);
assert_eq!(m.major(), 0);Tuple Fields§
§0: u8Implementations§
Source§impl Mhdr
impl Mhdr
Sourcepub const fn from_parts(m_type: MType, major: u8) -> Self
pub const fn from_parts(m_type: MType, major: u8) -> Self
Build MHDR from MType and major version (default major = 0).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mhdr
impl<'de> Deserialize<'de> for Mhdr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Mhdr
impl Eq for Mhdr
impl StructuralPartialEq for Mhdr
Auto Trait Implementations§
impl Freeze for Mhdr
impl RefUnwindSafe for Mhdr
impl Send for Mhdr
impl Sync for Mhdr
impl Unpin for Mhdr
impl UnsafeUnpin for Mhdr
impl UnwindSafe for Mhdr
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