pub struct Tlv8Map { /* private fields */ }Expand description
An owned, queryable view over reassembled TLV8 items.
Implementations§
Source§impl Tlv8Map
impl Tlv8Map
Sourcepub fn parse(bytes: &[u8]) -> Result<Self>
pub fn parse(bytes: &[u8]) -> Result<Self>
Parse a TLV8 byte stream and wrap the reassembled items.
§Errors
Propagates any Tlv8Error from Tlv8Reader::parse.
Sourcepub fn from_items(items: Vec<(u8, Vec<u8>)>) -> Self
pub fn from_items(items: Vec<(u8, Vec<u8>)>) -> Self
Wrap an already-parsed item list (no validation).
Sourcepub fn get(&self, ty: u8) -> Option<&[u8]>
pub fn get(&self, ty: u8) -> Option<&[u8]>
Value bytes of the first item with type ty, if present.
Sourcepub fn get_u8(&self, ty: u8) -> Result<Option<u8>>
pub fn get_u8(&self, ty: u8) -> Result<Option<u8>>
Decode the first item of type ty as a u8.
§Errors
Tlv8Error::IntegerTooLarge if the stored value has more than 1 byte.
Sourcepub fn get_u16(&self, ty: u8) -> Result<Option<u16>>
pub fn get_u16(&self, ty: u8) -> Result<Option<u16>>
Decode the first item of type ty as a little-endian u16.
§Errors
Tlv8Error::IntegerTooLarge if the stored value has more than 2 bytes.
Trait Implementations§
impl Eq for Tlv8Map
impl StructuralPartialEq for Tlv8Map
Auto Trait Implementations§
impl Freeze for Tlv8Map
impl RefUnwindSafe for Tlv8Map
impl Send for Tlv8Map
impl Sync for Tlv8Map
impl Unpin for Tlv8Map
impl UnsafeUnpin for Tlv8Map
impl UnwindSafe for Tlv8Map
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
Mutably borrows from an owned value. Read more