pub struct DeltaOfDeltaEncoder;Expand description
Encodes a sorted sequence of i64 timestamps using delta-of-delta encoding.
Implementations§
Source§impl DeltaOfDeltaEncoder
impl DeltaOfDeltaEncoder
Sourcepub fn encode(timestamps: &[i64]) -> Result<Vec<u8>>
pub fn encode(timestamps: &[i64]) -> Result<Vec<u8>>
Encode a sequence of timestamps.
§Overflow safety
All delta and delta-of-delta computations use wrapping arithmetic
(wrapping_sub). This is intentional: the encoding scheme stores
every delta-of-delta with a 64-bit raw fallback, so any i64
difference — including values that wrap — is captured losslessly
and decoded symmetrically via wrapping_add. Plain - / +
operators are avoided to prevent panics in debug builds.
§Errors
Returns EncodingError::EmptyInput if timestamps is empty.
Trait Implementations§
Source§impl Clone for DeltaOfDeltaEncoder
impl Clone for DeltaOfDeltaEncoder
Source§fn clone(&self) -> DeltaOfDeltaEncoder
fn clone(&self) -> DeltaOfDeltaEncoder
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 DeltaOfDeltaEncoder
Auto Trait Implementations§
impl Freeze for DeltaOfDeltaEncoder
impl RefUnwindSafe for DeltaOfDeltaEncoder
impl Send for DeltaOfDeltaEncoder
impl Sync for DeltaOfDeltaEncoder
impl Unpin for DeltaOfDeltaEncoder
impl UnsafeUnpin for DeltaOfDeltaEncoder
impl UnwindSafe for DeltaOfDeltaEncoder
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