Skip to main content

Serializer

Trait Serializer 

Source
pub trait Serializer {
    // Required methods
    fn write_u64(&mut self, value: u64);
    fn write_f32(&mut self, value: f32);
    fn write_bytes(&mut self, bytes: &[u8]);
}
Expand description

A sink for the primitive field types the container emits.

Implement this to control the binary layout. The container calls these in a fixed order.

Required Methods§

Source

fn write_u64(&mut self, value: u64)

Write a 64-bit integer field.

Source

fn write_f32(&mut self, value: f32)

Write a 32-bit float field.

Source

fn write_bytes(&mut self, bytes: &[u8])

Write raw bytes, such as string contents.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§