pub struct TlvEncoder;Expand description
Binary TLV encoder for envelope metadata
Implementations§
Source§impl TlvEncoder
impl TlvEncoder
Sourcepub fn encode(metadata: &EnvelopeMetadata) -> Result<Vec<u8>>
pub fn encode(metadata: &EnvelopeMetadata) -> Result<Vec<u8>>
Encodes metadata to TLV binary format
Entries are written in canonical order:
- Timestamp (0x10)
- Source (0x11)
- TraceID (0x12)
- Sequence (0x13)
§Example
use lnmp_envelope::{EnvelopeMetadata, binary_codec::TlvEncoder};
let mut metadata = EnvelopeMetadata::new();
metadata.timestamp = Some(1732373147000);
metadata.source = Some("auth-service".to_string());
let bytes = TlvEncoder::encode(&metadata).unwrap();
assert!(bytes.len() > 0);Auto Trait Implementations§
impl Freeze for TlvEncoder
impl RefUnwindSafe for TlvEncoder
impl Send for TlvEncoder
impl Sync for TlvEncoder
impl Unpin for TlvEncoder
impl UnwindSafe for TlvEncoder
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