pub struct LargeWindowSize(/* private fields */);Expand description
The large sliding window size (in bits) to use for compression.
Note that using a large sliding window size for a particular compressor
requires explicit support by the decompressor. This is supported by enabling
large_window_size when constructing a BrotliDecoder.
Implementations§
Source§impl LargeWindowSize
impl LargeWindowSize
Sourcepub const fn new(bits: u8) -> Result<LargeWindowSize, SetParameterError>
pub const fn new(bits: u8) -> Result<LargeWindowSize, SetParameterError>
Constructs a new large sliding window size (in bits) to use for brotli compression.
Valid bits range from 10 (1 KiB) to 30 (1 GiB) inclusive.
§Errors
An Err will be returned if the bits are out of the range of valid
large window sizes.
§Examples
use brotlic::LargeWindowSize;
let worst_size = LargeWindowSize::new(10)?;
let best_size = LargeWindowSize::new(30)?;
assert_eq!(worst_size, LargeWindowSize::worst());
assert_eq!(best_size, LargeWindowSize::best());Sourcepub const unsafe fn new_unchecked(bits: u8) -> LargeWindowSize
pub const unsafe fn new_unchecked(bits: u8) -> LargeWindowSize
Constructs a new large sliding window size (in bits) to use for brotli compression.
Valid bits range from 10 (1 KiB) to 30 (1 GiB) inclusive. Using a
number of bits outside of that range results in undefined behaviour.
§Safety
The number of bits must be between 10 and 30.
§Examples
use brotlic::LargeWindowSize;
// SAFETY: 28 is within the valid range of 10 to 30 in large window sizes
let window_size = unsafe { LargeWindowSize::new_unchecked(28) };
assert_eq!(window_size.bits(), 28);Sourcepub const fn best() -> LargeWindowSize
pub const fn best() -> LargeWindowSize
Constructs the best large sliding window size to use for brotli compression.
This is currently set to 30 bits (1 GiB). Note that this requires
explicit support by the decompressor. For more information see
LargeWindowSize.
§Examples
use brotlic::LargeWindowSize;
let best_size = LargeWindowSize::new(30)?;
assert_eq!(best_size, LargeWindowSize::best());Sourcepub const fn default() -> LargeWindowSize
pub const fn default() -> LargeWindowSize
Constructs the default large sliding window size to use for brotli compression.
This is currently set to 22 bits (4 MiB).
§Examples
use brotlic::LargeWindowSize;
let default_size = LargeWindowSize::new(22)?;
assert_eq!(default_size, LargeWindowSize::default());Sourcepub const fn worst() -> LargeWindowSize
pub const fn worst() -> LargeWindowSize
Constructs the worst large sliding window size to use for brotli compression
This is currently set to 10 bits (1 KiB).
§Examples
use brotlic::LargeWindowSize;
let worst_size = LargeWindowSize::new(10)?;
assert_eq!(worst_size, LargeWindowSize::worst());Trait Implementations§
Source§impl Clone for LargeWindowSize
impl Clone for LargeWindowSize
Source§fn clone(&self) -> LargeWindowSize
fn clone(&self) -> LargeWindowSize
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LargeWindowSize
impl Debug for LargeWindowSize
Source§impl Default for LargeWindowSize
impl Default for LargeWindowSize
Source§impl From<WindowSize> for LargeWindowSize
impl From<WindowSize> for LargeWindowSize
Source§fn from(window_size: WindowSize) -> Self
fn from(window_size: WindowSize) -> Self
Constructs a LargeWindowSize from a WindowSize.
This always works because a LargeWindowSize covers a larger range than
the regular WindowSize. The inverse is not true, however.
Source§impl Ord for LargeWindowSize
impl Ord for LargeWindowSize
Source§fn cmp(&self, other: &LargeWindowSize) -> Ordering
fn cmp(&self, other: &LargeWindowSize) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for LargeWindowSize
impl PartialEq for LargeWindowSize
Source§impl PartialOrd for LargeWindowSize
impl PartialOrd for LargeWindowSize
Source§impl TryFrom<LargeWindowSize> for WindowSize
impl TryFrom<LargeWindowSize> for WindowSize
Source§fn try_from(large_window_size: LargeWindowSize) -> Result<Self, Self::Error>
fn try_from(large_window_size: LargeWindowSize) -> Result<Self, Self::Error>
Attempts to construct a WindowSize from a LargeWindowSize.
This only works if the large window size is currently set to a value
lower or equal to WindowSize::best().
§Errors
Large window size does not fit into a window size.