pub enum MeshcopTlv<'a> {
NetworkName(NetworkName),
PanId(PanId),
Channel(u8, u16),
ActiveTimestamp(Timestamp),
PendingTimestamp(Timestamp),
DelayTimer(u32),
Unknown(u8, &'a [u8]),
}
Expand description
Represents a type-length-value (TLV) item.
Variants§
NetworkName(NetworkName)
PanId(PanId)
Channel(u8, u16)
ActiveTimestamp(Timestamp)
Active Timestamp.
PendingTimestamp(Timestamp)
Pending Timestamp.
DelayTimer(u32)
Delay Timer. Value in ms.
Unknown(u8, &'a [u8])
Implementations§
Source§impl<'a> MeshcopTlv<'a>
impl<'a> MeshcopTlv<'a>
Sourcepub fn value_as_u8(&self) -> Option<u8>
pub fn value_as_u8(&self) -> Option<u8>
Returns the value of this TLV as a u8
.
Sourcepub fn value_as_u16(&self) -> Option<u16>
pub fn value_as_u16(&self) -> Option<u16>
Returns the value of this TLV as a u16
.
Sourcepub fn value_as_u32(&self) -> Option<u32>
pub fn value_as_u32(&self) -> Option<u32>
Returns the value of this TLV as a u32
.
Sourcepub fn value_as_u64(&self) -> Option<u64>
pub fn value_as_u64(&self) -> Option<u64>
Returns the value of this TLV as a u64
.
Sourcepub fn value_as_slice(&self) -> Option<&[u8]>
pub fn value_as_slice(&self) -> Option<&[u8]>
Returns the value of this TLV as a &[u8]
.
Sourcepub fn write_to<T: Write>(&self, out: &mut T) -> Result<()>
pub fn write_to<T: Write>(&self, out: &mut T) -> Result<()>
Writes this TLV to the given slice, returning the trimmed
slice if the given slice was large enough to hold the value. If the given
slice was too small, it remains unchanged and the method returns None
.
Sourcepub fn write_value_to<T: Write>(&self, out: &mut T) -> Result<()>
pub fn write_value_to<T: Write>(&self, out: &mut T) -> Result<()>
Writes the value of this TLV to the given slice, returning the trimmed
slice if the given slice was large enough to hold the value. If the given
slice was too small, it remains unchanged and the method returns None
.
Sourcepub fn from_type_and_value(tlv_type: u8, value: &'a [u8]) -> MeshcopTlv<'a>
pub fn from_type_and_value(tlv_type: u8, value: &'a [u8]) -> MeshcopTlv<'a>
Constructs a TLV from type and value
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for MeshcopTlv<'a>
impl<'a> RefUnwindSafe for MeshcopTlv<'a>
impl<'a> Send for MeshcopTlv<'a>
impl<'a> Sync for MeshcopTlv<'a>
impl<'a> Unpin for MeshcopTlv<'a>
impl<'a> UnwindSafe for MeshcopTlv<'a>
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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more