Skip to main content

SerializeBytes

Trait SerializeBytes 

Source
pub trait SerializeBytes {
    // Required methods
    fn size_hint(&self) -> usize;
    fn write_bytes_to<B>(&self, buffer: &mut B) -> usize
       where B: Buffer;
    fn write_bytes_to_unchecked<B>(&self, buffer: &mut B) -> usize
       where B: Buffer;
}
Expand description

Trait for writing raw byte sequences without the inline/offset distinction.

Used for vtable bytes (emitted by share_vtable) and similar cases where the data is already in its final wire form.

Required Methods§

Source

fn size_hint(&self) -> usize

Source

fn write_bytes_to<B>(&self, buffer: &mut B) -> usize
where B: Buffer,

Source

fn write_bytes_to_unchecked<B>(&self, buffer: &mut B) -> usize
where B: Buffer,

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.

Implementations on Foreign Types§

Source§

impl SerializeBytes for &[u8]

SerializeBytes for raw byte slices — no alignment, no length prefix, bytes are written verbatim from the high end of the buffer.

Source§

fn size_hint(&self) -> usize

Source§

fn write_bytes_to<B>(&self, buffer: &mut B) -> usize
where B: Buffer,

Source§

fn write_bytes_to_unchecked<B>(&self, buffer: &mut B) -> usize
where B: Buffer,

Implementors§