pub struct RatioCompressor { /* private fields */ }
Expand description
Ratio Compressor
The ratio compressor uses the target size and a compression ration parameter to determine how much data can be written to the compressor before it’s considered full. The full calculation is as follows:
full = uncompressedLength * approxCompRatio >= targetFrameSize * targetNumFrames
The ratio compressor wraps a VariantCompressor which dispatches to the appropriate compression algorithm (ZLIB or Brotli).
Implementations§
Source§impl RatioCompressor
impl RatioCompressor
Sourcepub const fn new(
config: Config,
compressor: VariantCompressor,
) -> RatioCompressor
pub const fn new( config: Config, compressor: VariantCompressor, ) -> RatioCompressor
Create a new RatioCompressor with the given VariantCompressor.
Sourcepub fn input_threshold(&self) -> usize
pub fn input_threshold(&self) -> usize
Calculates the input threshold in bytes.
Trait Implementations§
Source§impl Clone for RatioCompressor
impl Clone for RatioCompressor
Source§fn clone(&self) -> RatioCompressor
fn clone(&self) -> RatioCompressor
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl CompressorWriter for RatioCompressor
impl CompressorWriter for RatioCompressor
Source§impl Debug for RatioCompressor
impl Debug for RatioCompressor
Source§impl From<Config> for RatioCompressor
impl From<Config> for RatioCompressor
Source§fn from(config: Config) -> RatioCompressor
fn from(config: Config) -> RatioCompressor
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for RatioCompressor
impl RefUnwindSafe for RatioCompressor
impl Send for RatioCompressor
impl Sync for RatioCompressor
impl Unpin for RatioCompressor
impl UnwindSafe for RatioCompressor
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