Skip to main content

pack_palette_indices

Function pack_palette_indices 

Source
pub(super) fn pack_palette_indices<'buffer, V: ToGlobalId + Copy>(
    values: &[V],
    palette: &[(V, u16)],
    bits: u8,
    buffer: &'buffer mut [u8; 8192],
) -> Result<&'buffer [u8]>
Expand description

Packs each value’s index in palette into buffer and returns the packed bytes.

The thread’s index table is released before this returns, so writing the bytes can encode other containers on the same thread.

§Errors

Returns ErrorKind::InvalidData if a value is missing from palette, which means the container’s palette invariant is broken.