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