pub struct TLVContainer<'a, T, C = ()> { /* private fields */ }Expand description
TLVContainer is an efficient (memory-wise) way to represent a serialized TLV container, in that
it does not materialize the container elements until the container is iterated over.
Therefore, TLVContainer is just a wrapper (newtype) of the serialized TLV container &[u8] slice.
Implementations§
Source§impl<'a, T, C> TLVContainer<'a, T, C>where
T: FromTLV<'a>,
impl<'a, T, C> TLVContainer<'a, T, C>where
T: FromTLV<'a>,
Sourcepub const fn new_unchecked(element: TLVElement<'a>) -> TLVContainer<'a, T, C>
pub const fn new_unchecked(element: TLVElement<'a>) -> TLVContainer<'a, T, C>
Creates a new TLVContainer from a TLV element.
The constructor does not check whether the passed slice is a valid TLV container.
pub fn element(&self) -> &TLVElement<'a>
Sourcepub fn iter(&self) -> TLVContainerIter<'a, T> ⓘ
pub fn iter(&self) -> TLVContainerIter<'a, T> ⓘ
Returns an iterator over the elements of the container.
Source§impl<'a, T> TLVContainer<'a, T>where
T: FromTLV<'a>,
impl<'a, T> TLVContainer<'a, T>where
T: FromTLV<'a>,
Sourcepub fn new(element: TLVElement<'a>) -> Result<TLVContainer<'a, T>, Error>
pub fn new(element: TLVElement<'a>) -> Result<TLVContainer<'a, T>, Error>
Creates a new TLVContainer from a TLV element that can be any container.
Source§impl<'a, T> TLVContainer<'a, T, ArrayContainer>where
T: FromTLV<'a>,
impl<'a, T> TLVContainer<'a, T, ArrayContainer>where
T: FromTLV<'a>,
Sourcepub fn new(
element: TLVElement<'a>,
) -> Result<TLVContainer<'a, T, ArrayContainer>, Error>
pub fn new( element: TLVElement<'a>, ) -> Result<TLVContainer<'a, T, ArrayContainer>, Error>
Creates a new TLVContainer from a TLV element that is expected to be of type array.
Source§impl<'a, T> TLVContainer<'a, T, ListContainer>where
T: FromTLV<'a>,
impl<'a, T> TLVContainer<'a, T, ListContainer>where
T: FromTLV<'a>,
Sourcepub fn new(
element: TLVElement<'a>,
) -> Result<TLVContainer<'a, T, ListContainer>, Error>
pub fn new( element: TLVElement<'a>, ) -> Result<TLVContainer<'a, T, ListContainer>, Error>
Creates a new TLVContainer from a TLV element that is expected to be of type list.
Source§impl<'a, T> TLVContainer<'a, T, StructContainer>where
T: FromTLV<'a>,
impl<'a, T> TLVContainer<'a, T, StructContainer>where
T: FromTLV<'a>,
Sourcepub fn new(
element: TLVElement<'a>,
) -> Result<TLVContainer<'a, T, StructContainer>, Error>
pub fn new( element: TLVElement<'a>, ) -> Result<TLVContainer<'a, T, StructContainer>, Error>
Creates a new TLVContainer from a TLV element that is expected to be of type struct.
Trait Implementations§
Source§impl<'a, T, C> Clone for TLVContainer<'a, T, C>
impl<'a, T, C> Clone for TLVContainer<'a, T, C>
Source§fn clone(&self) -> TLVContainer<'a, T, C>
fn clone(&self) -> TLVContainer<'a, T, C>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a, T, C> Debug for TLVContainer<'a, T, C>
impl<'a, T, C> Debug for TLVContainer<'a, T, C>
impl<'a, T, C> Eq for TLVContainer<'a, T, C>
Source§impl<'a, T, C> FromTLV<'a> for TLVContainer<'a, T, C>where
T: FromTLV<'a>,
C: 'a,
impl<'a, T, C> FromTLV<'a> for TLVContainer<'a, T, C>where
T: FromTLV<'a>,
C: 'a,
Source§fn from_tlv(element: &TLVElement<'a>) -> Result<TLVContainer<'a, T, C>, Error>
fn from_tlv(element: &TLVElement<'a>) -> Result<TLVContainer<'a, T, C>, 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, T, C> Hash for TLVContainer<'a, T, C>
impl<'a, T, C> Hash for TLVContainer<'a, T, C>
Source§impl<'a, T, C> IntoIterator for TLVContainer<'a, T, C>where
T: FromTLV<'a>,
impl<'a, T, C> IntoIterator for TLVContainer<'a, T, C>where
T: FromTLV<'a>,
Source§impl<'a, T, C> IntoIterator for &TLVContainer<'a, T, C>where
T: FromTLV<'a>,
impl<'a, T, C> IntoIterator for &TLVContainer<'a, T, C>where
T: FromTLV<'a>,
Source§impl<'a, T, C> PartialEq for TLVContainer<'a, T, C>
impl<'a, T, C> PartialEq for TLVContainer<'a, T, C>
impl<'a, T, C> StructuralPartialEq for TLVContainer<'a, T, C>
Source§impl<T, C> ToTLV for TLVContainer<'_, T, C>
impl<T, C> ToTLV for TLVContainer<'_, T, C>
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, T, C> Freeze for TLVContainer<'a, T, C>
impl<'a, T, C> RefUnwindSafe for TLVContainer<'a, T, C>where
C: RefUnwindSafe,
impl<'a, T, C> Send for TLVContainer<'a, T, C>where
C: Send,
impl<'a, T, C> Sync for TLVContainer<'a, T, C>where
C: Sync,
impl<'a, T, C> Unpin for TLVContainer<'a, T, C>where
C: Unpin,
impl<'a, T, C> UnsafeUnpin for TLVContainer<'a, T, C>
impl<'a, T, C> UnwindSafe for TLVContainer<'a, T, C>where
C: UnwindSafe,
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