Trait Encoder

Source
pub trait Encoder {
    // Required method
    fn encode_quads(
        input: &[u32],
        control_bytes: &mut [u8],
        output: &mut [u8],
    ) -> (usize, usize);
}
Expand description

Encode numbers to bytes.

Required Methods§

Source

fn encode_quads( input: &[u32], control_bytes: &mut [u8], output: &mut [u8], ) -> (usize, usize)

Encode complete quads of input numbers.

control_bytes will be exactly as long as the number of complete 4-number quads in input.

Control bytes are written to control_bytes and encoded numbers to output.

Implementations may choose to encode fewer than the full provided input, but any writes done must be for full quads.

Implementations must not write to output outside of the area that will be populated by encoded numbers when all control bytes are processed..

Returns the number of numbers encoded and the number of bytes written to output.

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§