pub struct TlvDecoder;Expand description
Binary TLV decoder for envelope metadata
Implementations§
Source§impl TlvDecoder
impl TlvDecoder
Sourcepub fn decode(data: &[u8]) -> Result<EnvelopeMetadata>
pub fn decode(data: &[u8]) -> Result<EnvelopeMetadata>
Decodes metadata from TLV binary format
Unknown TRV types are skipped gracefully for forward compatibility.
§Example
use lnmp_envelope::binary_codec::{TlvEncoder, TlvDecoder};
use lnmp_envelope::EnvelopeMetadata;
let mut original = EnvelopeMetadata::new();
original.timestamp = Some(1732373147000);
original.source = Some("test".to_string());
let bytes = TlvEncoder::encode(&original).unwrap();
let decoded = TlvDecoder::decode(&bytes).unwrap();
assert_eq!(original, decoded);Auto Trait Implementations§
impl Freeze for TlvDecoder
impl RefUnwindSafe for TlvDecoder
impl Send for TlvDecoder
impl Sync for TlvDecoder
impl Unpin for TlvDecoder
impl UnwindSafe for TlvDecoder
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