AddressingFields

Struct AddressingFields 

Source
pub struct AddressingFields<T: AsRef<[u8]>, FC: AsRef<[u8]>> { /* private fields */ }
Expand description

A reader/writer for the IEEE 802.15.4 Addressing Fields.

Implementations§

Source§

impl<T: AsRef<[u8]>, FC: AsRef<[u8]>> AddressingFields<T, FC>

Source

pub fn new(buffer: T, fc: FrameControl<FC>) -> Result<Self>

Create a new AddressingFields reader/writer from a given buffer.

§Errors

This function will check the length of the buffer to ensure it is large enough to contain the addressing fields. If the buffer is too small, an error will be returned.

Source

pub fn new_unchecked(buffer: T, fc: FrameControl<FC>) -> Self

Create a new AddressingFields reader/writer from a given buffer without checking the length.

Source

pub fn len(&self) -> usize

Return the length of the Addressing Fields in octets.

Source

pub fn dst_address(&self) -> Option<Address>

Return the IEEE 802.15.4 destination Address if not absent.

Source

pub fn src_address(&self) -> Option<Address>

Return the IEEE 802.15.4 source Address if not absent.

Source

pub fn dst_pan_id(&self) -> Option<u16>

Return the IEEE 802.15.4 destination PAN ID if not elided.

Source

pub fn src_pan_id(&self) -> Option<u16>

Return the IEEE 802.15.4 source PAN ID if not elided.

Source§

impl<T: AsRef<[u8]> + AsMut<[u8]>, FC: AsRef<[u8]>> AddressingFields<T, FC>

Source

pub fn write_fields(&mut self, fields: &AddressingFieldsRepr)

Write the addressing fields to the buffer.

Trait Implementations§

Source§

impl<T: AsRef<[u8]>, FC: AsRef<[u8]>> Display for AddressingFields<T, FC>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, FC> Freeze for AddressingFields<T, FC>
where T: Freeze, FC: Freeze,

§

impl<T, FC> RefUnwindSafe for AddressingFields<T, FC>

§

impl<T, FC> Send for AddressingFields<T, FC>
where T: Send, FC: Send,

§

impl<T, FC> Sync for AddressingFields<T, FC>
where T: Sync, FC: Sync,

§

impl<T, FC> Unpin for AddressingFields<T, FC>
where T: Unpin, FC: Unpin,

§

impl<T, FC> UnwindSafe for AddressingFields<T, FC>
where T: UnwindSafe, FC: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.