Skip to main content

BitPacker

Trait BitPacker 

Source
pub trait BitPacker:
    Sized
    + Clone
    + Copy {
    const BLOCK_LEN: usize;

    // Required methods
    fn new() -> Self;
    fn compress(
        &self,
        decompressed: &[u32],
        compressed: &mut [u8],
        num_bits: u8,
    ) -> usize;
    fn compress_sorted(
        &self,
        initial: u32,
        decompressed: &[u32],
        compressed: &mut [u8],
        num_bits: u8,
    ) -> usize;
    fn compress_strictly_sorted(
        &self,
        initial: Option<u32>,
        decompressed: &[u32],
        compressed: &mut [u8],
        num_bits: u8,
    ) -> usize;
    fn decompress(
        &self,
        compressed: &[u8],
        decompressed: &mut [u32],
        num_bits: u8,
    ) -> usize;
    fn decompress_sorted(
        &self,
        initial: u32,
        compressed: &[u8],
        decompressed: &mut [u32],
        num_bits: u8,
    ) -> usize;
    fn decompress_strictly_sorted(
        &self,
        initial: Option<u32>,
        compressed: &[u8],
        decompressed: &mut [u32],
        num_bits: u8,
    ) -> usize;
    fn num_bits(&self, decompressed: &[u32]) -> u8;
    fn num_bits_sorted(&self, initial: u32, decompressed: &[u32]) -> u8;
    fn num_bits_strictly_sorted(
        &self,
        initial: Option<u32>,
        decompressed: &[u32],
    ) -> u8;

    // Provided method
    fn compressed_block_size(num_bits: u8) -> usize { ... }
}
Expand description

Block bitpacker for fixed-size u32 blocks.

Implementations own runtime SIMD dispatch and use caller-provided buffers. Packed bytes are stable for a given implementation and bit width.

Required Associated Constants§

Source

const BLOCK_LEN: usize

Number of u32 values in one physical block.

Required Methods§

Source

fn new() -> Self

Select the best supported implementation for the current CPU.

Lance uses SIMD backends when available and falls back to a scalar backend otherwise, matching the existing allocation-free call shape used by the upstream bitpacking crate.

Source

fn compress( &self, decompressed: &[u32], compressed: &mut [u8], num_bits: u8, ) -> usize

Compress one full block of raw values into compressed.

Source

fn compress_sorted( &self, initial: u32, decompressed: &[u32], compressed: &mut [u8], num_bits: u8, ) -> usize

Delta-compress one full non-decreasing block into compressed.

Source

fn compress_strictly_sorted( &self, initial: Option<u32>, decompressed: &[u32], compressed: &mut [u8], num_bits: u8, ) -> usize

Delta-compress one full strictly increasing block into compressed.

Source

fn decompress( &self, compressed: &[u8], decompressed: &mut [u32], num_bits: u8, ) -> usize

Decompress one raw block into decompressed.

Source

fn decompress_sorted( &self, initial: u32, compressed: &[u8], decompressed: &mut [u32], num_bits: u8, ) -> usize

Decompress one delta-compressed non-decreasing block.

Source

fn decompress_strictly_sorted( &self, initial: Option<u32>, compressed: &[u8], decompressed: &mut [u32], num_bits: u8, ) -> usize

Decompress one delta-compressed strictly increasing block.

Source

fn num_bits(&self, decompressed: &[u32]) -> u8

Return the minimum bit width needed to represent a full raw block.

Source

fn num_bits_sorted(&self, initial: u32, decompressed: &[u32]) -> u8

Return the minimum bit width needed to represent deltas in a full block.

Source

fn num_bits_strictly_sorted( &self, initial: Option<u32>, decompressed: &[u32], ) -> u8

Return the minimum bit width needed to represent strict deltas in a full block.

Provided Methods§

Source

fn compressed_block_size(num_bits: u8) -> usize

Return the byte size of one compressed block at num_bits.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§