pub struct AdaptiveCompressor { /* private fields */ }Expand description
Adaptive compressor: buffers samples, then chooses and applies the best
algorithm when finish is called.
§Example
ⓘ
let mut comp = AdaptiveCompressor::new();
for (ts, val) in sensor_data {
comp.push(ts, val);
}
let block = comp.finish()?;
println!("Used: {}, ratio: {:.1}", block.algorithm, block.compression_ratio());Implementations§
Source§impl AdaptiveCompressor
impl AdaptiveCompressor
Sourcepub fn with_algorithm(self, algo: CompressionAlgorithm) -> Self
pub fn with_algorithm(self, algo: CompressionAlgorithm) -> Self
Force use of a specific algorithm regardless of data characteristics.
Sourcepub fn finish(self) -> TsdbResult<CompressedBlock>
pub fn finish(self) -> TsdbResult<CompressedBlock>
Compress the buffered samples and return a self-describing block.
After calling finish, the compressor is consumed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdaptiveCompressor
impl RefUnwindSafe for AdaptiveCompressor
impl Send for AdaptiveCompressor
impl Sync for AdaptiveCompressor
impl Unpin for AdaptiveCompressor
impl UnsafeUnpin for AdaptiveCompressor
impl UnwindSafe for AdaptiveCompressor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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