pub struct VarintEncoder;Expand description
Integer encoder using Delta + ZigZag + LEB128 varint per delta.
Unlike IntegerEncoder which uses a uniform bit width for all deltas
(determined by the largest delta), this encoder uses LEB128 varint
encoding so each delta occupies only the bytes it needs.
This is more efficient for sparse or highly variable data where most deltas are small but occasional large outliers would inflate the fixed bit width.
§Wire format
[count: u32 LE][first_value: i64 LE][zigzag(delta₀) as varint]…Implementations§
Source§impl VarintEncoder
impl VarintEncoder
Sourcepub fn encode_i64(values: &[i64]) -> Result<Vec<u8>>
pub fn encode_i64(values: &[i64]) -> Result<Vec<u8>>
Encode a sequence of i64 values using delta + ZigZag + LEB128 varint.
§Errors
Returns EncodingError::EmptyInput if values is empty.
Trait Implementations§
Source§impl Clone for VarintEncoder
impl Clone for VarintEncoder
Source§fn clone(&self) -> VarintEncoder
fn clone(&self) -> VarintEncoder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for VarintEncoder
Auto Trait Implementations§
impl Freeze for VarintEncoder
impl RefUnwindSafe for VarintEncoder
impl Send for VarintEncoder
impl Sync for VarintEncoder
impl Unpin for VarintEncoder
impl UnsafeUnpin for VarintEncoder
impl UnwindSafe for VarintEncoder
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
Mutably borrows from an owned value. Read more