CompactEnvelope

Trait CompactEnvelope 

Source
pub trait CompactEnvelope: Sized {
    // Required methods
    fn to_compact<B>(&self, buf: &mut B) -> usize
       where B: BufMut + AsMut<[u8]>;
    fn from_compact(buf: &[u8], len: usize) -> (Self, &[u8]);
}
Available on crate feature test-utils only.
Expand description

Compact serialization for transaction envelopes with compression and bitfield packing.

Required Methods§

Source

fn to_compact<B>(&self, buf: &mut B) -> usize
where B: BufMut + AsMut<[u8]>,

Takes a buffer which can be written to. Ideally, it returns the length written to.

Source

fn from_compact(buf: &[u8], len: usize) -> (Self, &[u8])

Takes a buffer which can be read from. Returns the object and buf with its internal cursor advanced (eg..advance(len)).

len can either be the buf remaining length, or the length of the compacted type.

It will panic, if len is smaller than buf.len().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Envelope + ToTxCompact + Transaction + Send + Sync> CompactEnvelope for T