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§
fn size_hint(&self) -> usize
fn write_bytes_to<B>(&self, buffer: &mut B) -> usizewhere
B: Buffer,
fn write_bytes_to_unchecked<B>(&self, buffer: &mut B) -> usizewhere
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.
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.