pub struct RatioCompressor { /* private fields */ }
Available on crate feature
protocol
only.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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