pub trait TimestampEncoding: Send + Sync {
// Required methods
fn encode(timestamp: u64) -> Vec<u8> ⓘ;
fn decode(bytes: &[u8]) -> Result<u64, EncodingError>;
fn supports_random_access() -> bool;
}Expand description
Trait for encoding timestamps into sortable byte representations.
Different encoding strategies optimize for different use cases:
AbsoluteEncoding: Simple, fast, supports random accessDeltaEncoding: Space-efficient for dense regular-interval data
Required Methods§
Sourcefn encode(timestamp: u64) -> Vec<u8> ⓘ
fn encode(timestamp: u64) -> Vec<u8> ⓘ
Encodes a timestamp (milliseconds since epoch) into a sortable byte representation.
Sourcefn decode(bytes: &[u8]) -> Result<u64, EncodingError>
fn decode(bytes: &[u8]) -> Result<u64, EncodingError>
Decodes a timestamp from its byte representation.
Sourcefn supports_random_access() -> bool
fn supports_random_access() -> bool
Returns true if this encoding supports direct seeking to arbitrary timestamps.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.