pub struct SixlowpanExtHeaderRepr {
pub ext_header_id: ExtHeaderId,
pub next_header: NextHeader,
pub length: u8,
}Expand description
The fields of a 6LoWPAN NHC extension header.
The header has the following format (RFC 6282 § 4.2):
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 0 | EID |NH |
+---+---+---+---+---+---+---+---+An inline next header, if NH is clear, and the length follow it.
Fields§
§ext_header_id: ExtHeaderId§next_header: NextHeader§length: u8The length of the payload, in bytes.
Implementations§
Source§impl ExtHeaderRepr
impl ExtHeaderRepr
Sourcepub fn parse(buf: &[u8]) -> Result<(Self, usize)>
pub fn parse(buf: &[u8]) -> Result<(Self, usize)>
Parse a compressed extension header from the front of buf.
Returns the header and its length, not counting the payload.
Errors:
Errorif the buffer is shorter than the header, or does not start with an extension header dispatch.
Sourcepub const fn buffer_len(&self) -> usize
pub const fn buffer_len(&self) -> usize
Return the length of the header this will emit, not counting the payload.
Sourcepub fn emit(&self, buf: &mut [u8])
pub fn emit(&self, buf: &mut [u8])
Write the header into the front of buf.
Writes exactly buffer_len bytes.
§Panics
Panics if buf is shorter than buffer_len.
Trait Implementations§
Source§impl Clone for ExtHeaderRepr
impl Clone for ExtHeaderRepr
Source§fn clone(&self) -> ExtHeaderRepr
fn clone(&self) -> ExtHeaderRepr
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ExtHeaderRepr
Source§impl Debug for ExtHeaderRepr
impl Debug for ExtHeaderRepr
impl Eq for ExtHeaderRepr
Source§impl PartialEq for ExtHeaderRepr
impl PartialEq for ExtHeaderRepr
impl StructuralPartialEq for ExtHeaderRepr
Auto Trait Implementations§
impl Freeze for ExtHeaderRepr
impl RefUnwindSafe for ExtHeaderRepr
impl Send for ExtHeaderRepr
impl Sync for ExtHeaderRepr
impl Unpin for ExtHeaderRepr
impl UnsafeUnpin for ExtHeaderRepr
impl UnwindSafe for ExtHeaderRepr
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