Enum capsules_extra::net::thread::tlv::Tlv

source ·
pub enum Tlv<'a> {
Show 18 variants SourceAddress(u16), Mode(u8), Timeout(u32), Challenge([u8; 8]), Response([u8; 8]), LinkLayerFrameCounter(u32), MleFrameCounter(u32), Address16(u16), LeaderData { partition_id: u32, weighting: u8, data_version: u8, stable_data_version: u8, leader_router_id: u8, }, NetworkData(&'a [u8]), TlvRequest(&'a [u8]), ScanMask(u8), Connectivity { parent_priority: u8, link_quality_3: u8, link_quality_2: u8, link_quality_1: u8, leader_cost: u8, id_sequence: u8, active_routers: u8, sed_buffer_size: Option<u16>, sed_datagram_count: Option<u8>, }, LinkMargin(u8), Status(u8), Version(u16), ActiveOperationalDataset(&'a [u8]), PendingOperationalDataset(&'a [u8]),
}
Expand description

Type-Length-Value structure.

Variants§

§

SourceAddress(u16)

§

Mode(u8)

§

Timeout(u32)

§

Challenge([u8; 8])

§

Response([u8; 8])

§

LinkLayerFrameCounter(u32)

§

MleFrameCounter(u32)

§

Address16(u16)

§

LeaderData

Fields

§partition_id: u32
§weighting: u8
§data_version: u8
§stable_data_version: u8
§leader_router_id: u8
§

NetworkData(&'a [u8])

§

TlvRequest(&'a [u8])

§

ScanMask(u8)

§

Connectivity

Fields

§parent_priority: u8
§link_quality_3: u8
§link_quality_2: u8
§link_quality_1: u8
§leader_cost: u8
§id_sequence: u8
§active_routers: u8
§sed_buffer_size: Option<u16>
§sed_datagram_count: Option<u8>
§

LinkMargin(u8)

§

Status(u8)

§

Version(u16)

§

ActiveOperationalDataset(&'a [u8])

§

PendingOperationalDataset(&'a [u8])

Implementations§

source§

impl Tlv<'_>

source

pub fn encode(&self, buf: &mut [u8]) -> SResult

Serializes TLV data in buf into the format specific to the TLV type.

source

pub fn decode(buf: &[u8]) -> SResult<Tlv<'_>>

Deserializes TLV data from buf into the TLV variant specific to the TLV type. SResult::Error is returned if the type field does not match any implemented TLV type.

Trait Implementations§

source§

impl From<&Tlv<'_>> for TlvType

source§

fn from(tlv: &Tlv<'_>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for Tlv<'a>

§

impl<'a> RefUnwindSafe for Tlv<'a>

§

impl<'a> Send for Tlv<'a>

§

impl<'a> Sync for Tlv<'a>

§

impl<'a> Unpin for Tlv<'a>

§

impl<'a> UnwindSafe for Tlv<'a>

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>,

§

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>,

§

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.