pub enum TLVValue<'a> {
}Expand description
A high-level representation of a TLV value.
Combined with TLVTag into a TLV struct it is a convenient way
to emit TLV byte sequences.
A TLVValue can be constructed programmatically, or returned from a TLVElement.
Unlike a TLVElement however, a TLVValue does not represent a complete container,
but rather, its beginning or end.
Variants§
S8(i8)
S16(i16)
S32(i32)
S64(i64)
U8(u8)
U16(u16)
U32(u32)
U64(u64)
False
True
F32(f32)
F64(f64)
Utf8l(&'a str)
Utf16l(&'a str)
Utf32l(&'a str)
Utf64l(&'a str)
Str8l(&'a [u8])
Str16l(&'a [u8])
Str32l(&'a [u8])
Str64l(&'a [u8])
Null
Struct
Array
List
EndCnt
Implementations§
Source§impl<'a> TLVValue<'a>
impl<'a> TLVValue<'a>
Sourcepub const fn value_type(&self) -> TLVValueType
pub const fn value_type(&self) -> TLVValueType
Return the value type of the TLV value.
Sourcepub const fn i16(value: i16) -> TLVValue<'a>
pub const fn i16(value: i16) -> TLVValue<'a>
Create a TLV value as an S8 or S16 TLV value, depending on whether the value is small enough to fit in an S8 TLV value.
Sourcepub const fn i32(value: i32) -> TLVValue<'a>
pub const fn i32(value: i32) -> TLVValue<'a>
Create a TLV value as an S8, S16, or S32 TLV value, depending on whether the value is small enough to fit in an S8 or S16 TLV value.
Sourcepub const fn i64(value: i64) -> TLVValue<'a>
pub const fn i64(value: i64) -> TLVValue<'a>
Create a TLV value as an S8, S16, S32, or S64 TLV value, depending on whether the value is small enough to fit in an S8, S16, or S32 TLV value.
Sourcepub const fn u16(value: u16) -> TLVValue<'a>
pub const fn u16(value: u16) -> TLVValue<'a>
Create a TLV value as a U8 or U16 TLV value, depending on whether the value is small enough to fit in a U8 TLV value.
Sourcepub const fn u32(value: u32) -> TLVValue<'a>
pub const fn u32(value: u32) -> TLVValue<'a>
Create a TLV value as a U8, U16, or U32 TLV value, depending on whether the value is small enough to fit in a U8 or U16 TLV value.
Sourcepub const fn u64(value: u64) -> TLVValue<'a>
pub const fn u64(value: u64) -> TLVValue<'a>
Create a TLV value as a U8, U16, U32, or U64 TLV value, depending on whether the value is small enough to fit in a U8, U16, or U32 TLV value.
Sourcepub const fn utf8(value: &'a str) -> TLVValue<'a>
pub const fn utf8(value: &'a str) -> TLVValue<'a>
Create a TLV value as a UTF-8 TLV value. The length of the string is encoded as 1, 2, 4 or 8 octets, depending on the length of the string.
Sourcepub const fn str(value: &'a [u8]) -> TLVValue<'a>
pub const fn str(value: &'a [u8]) -> TLVValue<'a>
Create a TLV value as an octet string TLV value. The length of the string is encoded as 1, 2, 4 or 8 octets, depending on the length of the string.
Sourcepub const fn end_container() -> TLVValue<'a>
pub const fn end_container() -> TLVValue<'a>
Create a TLV value of type EndCnt (container end).
Sourcepub const fn bool(value: bool) -> TLVValue<'a>
pub const fn bool(value: bool) -> TLVValue<'a>
Create a TLV value of type boolean (True or False).
Sourcepub fn iter(&self) -> TLVValueIter<'a, &TLVValue<'a>> ⓘ
pub fn iter(&self) -> TLVValueIter<'a, &TLVValue<'a>> ⓘ
Return an iterator over the bytes of the TLV value.
Sourcepub fn into_iterator(self) -> TLVValueIter<'a, TLVValue<'a>> ⓘ
pub fn into_iterator(self) -> TLVValueIter<'a, TLVValue<'a>> ⓘ
Converts itself into an iterator over the bytes of the TLV value.
Trait Implementations§
Source§impl<'a> FromTLV<'a> for TLVValue<'a>
impl<'a> FromTLV<'a> for TLVValue<'a>
Source§fn from_tlv(element: &TLVElement<'a>) -> Result<TLVValue<'a>, Error>
fn from_tlv(element: &TLVElement<'a>) -> Result<TLVValue<'a>, Error>
Source§fn init_from_tlv(element: TLVElement<'a>) -> impl Init<Self, Error>
fn init_from_tlv(element: TLVElement<'a>) -> impl Init<Self, Error>
Source§fn nullable_from_tlv(element: &TLVElement<'a>) -> Result<Self, Error>
fn nullable_from_tlv(element: &TLVElement<'a>) -> Result<Self, Error>
Source§fn init_nullable_from_tlv(element: TLVElement<'a>) -> impl Init<Self, Error>
fn init_nullable_from_tlv(element: TLVElement<'a>) -> impl Init<Self, Error>
Source§impl<'a> IntoIterator for TLVValue<'a>
impl<'a> IntoIterator for TLVValue<'a>
Source§impl<'a> IntoIterator for &TLVValue<'a>
impl<'a> IntoIterator for &TLVValue<'a>
impl<'a> StructuralPartialEq for TLVValue<'a>
Source§impl ToTLV for TLVValue<'_>
impl ToTLV for TLVValue<'_>
Source§fn to_tlv<W>(&self, tag: &TLVTag, tw: W) -> Result<(), Error>where
W: TLVWrite,
fn to_tlv<W>(&self, tag: &TLVTag, tw: W) -> Result<(), Error>where
W: TLVWrite,
Source§fn tlv_iter(&self, tag: TLVTag) -> impl Iterator<Item = Result<TLV<'_>, Error>>
fn tlv_iter(&self, tag: TLVTag) -> impl Iterator<Item = Result<TLV<'_>, Error>>
TLV instances by potentially borrowing
data from the type.Auto Trait Implementations§
impl<'a> Freeze for TLVValue<'a>
impl<'a> RefUnwindSafe for TLVValue<'a>
impl<'a> Send for TLVValue<'a>
impl<'a> Sync for TLVValue<'a>
impl<'a> Unpin for TLVValue<'a>
impl<'a> UnsafeUnpin for TLVValue<'a>
impl<'a> UnwindSafe for TLVValue<'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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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