Struct q_compress::Prefix

source ·
#[non_exhaustive]
pub struct Prefix<T: NumberLike> { pub count: usize, pub code: Vec<bool>, pub lower: T, pub upper: T, pub run_len_jumpstart: Option<usize>, pub gcd: T::Unsigned, }
Expand description

A pairing of a Huffman code with a numerical range.

Quantile Compression works by splitting the distribution of numbers into ranges and associating a Huffman code (a short sequence of bits) with each range. The combination of these pieces of information, plus a couple others, is called a Prefix. When compressing a number, the compressor finds the prefix containing it, then writes out its Huffman code, optionally the number of consecutive repetitions of that number if run_length_jumpstart is available, and then the exact offset within the range for the number.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§count: usize

The count of numbers in the chunk that fall into this Prefix’s range. Not available in wrapped mode.

§code: Vec<bool>

The Huffman code for this prefix. Collectively, all the prefixes for a chunk form a binary search tree (BST) over these Huffman codes. The BST over Huffman codes is different from the BST over numerical ranges.

§lower: T

The lower bound for this prefix’s numerical range.

§upper: T

The upper bound (inclusive) for this prefix’s numerical range.

§run_len_jumpstart: Option<usize>

A parameter used for the most common prefix in a sparse distribution. For instance, if 90% of a chunk’s numbers are exactly 7, then the prefix for the range [7, 7] will have a run_len_jumpstart. The jumpstart value tunes the varint encoding of the number of consecutive repetitions of the prefix.

§gcd: T::Unsigned

The greatest common divisor of all numbers belonging to this prefix (in the data type’s corresponding unsigned integer).

Trait Implementations§

source§

impl<T: Clone + NumberLike> Clone for Prefix<T>where T::Unsigned: Clone,

source§

fn clone(&self) -> Prefix<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + NumberLike> Debug for Prefix<T>where T::Unsigned: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: NumberLike> Display for Prefix<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: PartialEq + NumberLike> PartialEq<Prefix<T>> for Prefix<T>where T::Unsigned: PartialEq,

source§

fn eq(&self, other: &Prefix<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Eq + NumberLike> Eq for Prefix<T>where T::Unsigned: Eq,

source§

impl<T: NumberLike> StructuralEq for Prefix<T>

source§

impl<T: NumberLike> StructuralPartialEq for Prefix<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Prefix<T>where T: RefUnwindSafe, <T as NumberLike>::Unsigned: RefUnwindSafe,

§

impl<T> Send for Prefix<T>where T: Send, <T as NumberLike>::Unsigned: Send,

§

impl<T> Sync for Prefix<T>where T: Sync, <T as NumberLike>::Unsigned: Sync,

§

impl<T> Unpin for Prefix<T>where T: Unpin, <T as NumberLike>::Unsigned: Unpin,

§

impl<T> UnwindSafe for Prefix<T>where T: UnwindSafe, <T as NumberLike>::Unsigned: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.