pub struct SixlowpanUdpNhcPacket<T: AsRef<[u8]>> { /* private fields */ }Expand description
A read/write wrapper around a 6LoWPAN_NHC UDP frame. RFC 6282 § 4.3 specifies the format of the header.
The base header has the following format:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | C | P |
+---+---+---+---+---+---+---+---+
With:
- C: checksum, specifies if the checksum is elided.
- P: ports, specifies if the ports are elided.Implementations§
Source§impl<T: AsRef<[u8]>> UdpNhcPacket<T>
impl<T: AsRef<[u8]>> UdpNhcPacket<T>
Sourcepub const fn new_unchecked(buffer: T) -> Self
pub const fn new_unchecked(buffer: T) -> Self
Input a raw octet buffer with a LOWPAN_NHC frame structure for UDP.
Sourcepub fn new_checked(buffer: T) -> Result<Self>
pub fn new_checked(buffer: T) -> Result<Self>
Shorthand for a combination of new_unchecked and check_len.
Sourcepub fn check_len(&self) -> Result<()>
pub fn check_len(&self) -> Result<()>
Ensure that no accessor method will panic if called.
Returns Err(Error::Truncated) if the buffer is too short.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the frame, returning the underlying buffer.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for UdpNhcPacket<T>where
T: Freeze,
impl<T> RefUnwindSafe for UdpNhcPacket<T>where
T: RefUnwindSafe,
impl<T> Send for UdpNhcPacket<T>where
T: Send,
impl<T> Sync for UdpNhcPacket<T>where
T: Sync,
impl<T> Unpin for UdpNhcPacket<T>where
T: Unpin,
impl<T> UnwindSafe for UdpNhcPacket<T>where
T: UnwindSafe,
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