Trait Decoder

Source
pub trait Decoder {
    type DecodedQuad;

    // Required method
    fn decode_quads<S: DecodeQuadSink<Self>>(
        control_bytes: &[u8],
        encoded_nums: &[u8],
        max_control_bytes_to_decode: usize,
        nums_already_decoded: usize,
        sink: &mut S,
    ) -> (usize, usize);
}
Expand description

Decode bytes to numbers.

Required Associated Types§

Required Methods§

Source

fn decode_quads<S: DecodeQuadSink<Self>>( control_bytes: &[u8], encoded_nums: &[u8], max_control_bytes_to_decode: usize, nums_already_decoded: usize, sink: &mut S, ) -> (usize, usize)

Decode encoded numbers in complete quads.

Only control bytes with 4 corresponding encoded numbers will be provided as input (i.e. no trailing partial quad).

control_bytes are the control bytes that correspond to encoded_nums.

max_control_bytes_to_decode may be greater than the number of control bytes remaining, in which case only the remaining control bytes will be decoded.

Implementations may decode at most max_control_bytes_to_decode control bytes, but may decode fewer.

nums_already_decoded is the number of numbers that have already been decoded in the DecodeCursor.decode invocation.

Returns a tuple of the number of numbers decoded (always a multiple of 4; at most 4 * max_control_bytes_to_decode) and the number of bytes read from encoded_nums.

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§