pub enum CodecSpec {
}
Expand description
Variants§
Gamma
Use Elias γ-coding.
The implied probability distribution is approximately 1 / (2*x^2)
.
This code is parameter-free and is generally effective for data distributions
skewed towards small values.
Delta
Use Elias δ-coding. This is the default codec spec.
The implied probability distribution is approximately 1 / (2*x*log(x)^2)
.
Delta coding is also parameter-free and tends to be more efficient than
Gamma for larger integer values.
Unary
Use Unary coding.
Represents the number n
with n
zeros followed by a one. It is only
efficient for very small integers, particularly 0
and 1
.
Rice
Use Rice-coding.
A special case of Golomb coding suitable for geometrically distributed data.
- If
log2_b
isSome(val)
, uses the specified parameter. - If
log2_b
isNone
(on slice-based builder), an optimal parameter is estimated from the data’s average value.
Zeta
Use Boldi-Vigna ζ-coding.
The implied probability distribution is approximately 1 / x^(1 + 1/k)
.
This code is effective for power-law distributions.
- If
k
isSome(val)
, uses the specified parameter (k > 0
). - If
k
isNone
(on slice-based builder), a default ofk=3
is used.
Golomb
Use Golomb-coding.
Suitable for geometrically distributed data.
- If
b
isSome(val)
, uses the specified parameter (b > 0
). - If
b
isNone
(on slice-based builder), an optimal parameter is estimated from the data’s average value.
Omega
Use Elias-Fano ω-coding, a universal code for positive integers.
Pi
Use an alternative universal code for positive integers.
- If
k
isSome(val)
, uses the specified parameter (k > 0
). - If
k
isNone
(on slice-based builder), a default ofk=3
is used.
ExpGolomb
Use Elias-Fano Exponential-Golomb coding.
- If
k
isSome(val)
, uses the specified parameter. - If
k
isNone
(on slice-based builder), a default ofk=2
is used.
VByteLe
Use VByte encoding with Little-Endian byte order. Efficient for integers that fit within a few bytes.
VByteBe
Use VByte encoding with Big-Endian byte order.
FixedLength
Use fixed-width integer encoding.
Optimal for uniformly distributed data within a known range.
- If
num_bits
isSome(val)
, uses the specified number of bits. - If
num_bits
isNone
(on slice-based builder), the minimum bits required for the largest value in the data is used.
Auto
Automatically select the best variable-length code based on the data.
This is the recommended default for the slice-based builder. This option is not supported for the iterator-based builder.
Explicit(Codes)
Use an explicitly provided code from the dsi-bitstream library enum.
This is an escape hatch for advanced use cases or for codes not yet
directly enumerated in CodecSpec
.
Trait Implementations§
impl Copy for CodecSpec
impl Eq for CodecSpec
impl StructuralPartialEq for CodecSpec
Auto Trait Implementations§
impl Freeze for CodecSpec
impl RefUnwindSafe for CodecSpec
impl Send for CodecSpec
impl Sync for CodecSpec
impl Unpin for CodecSpec
impl UnwindSafe for CodecSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more