pub struct WindowLimit { /* private fields */ }Expand description
Accepted window headers and their maximum bit count.
This limits headers, not total output or allocated workspace. Use
DecodeLimits to set those budgets. An extended header may declare a
small window too; Self::standard rejects every extended header.
§Examples
use mbrotli::WindowLimit;
let standard = WindowLimit::standard(24)?;
assert_eq!(standard.max_bits(), 24);
assert!(!standard.allows_large());
let extended = WindowLimit::large(24)?;
assert!(extended.allows_large());
assert!(WindowLimit::standard(25).is_err());Implementations§
Source§impl WindowLimit
impl WindowLimit
Sourcepub const fn standard(max_bits: u8) -> Result<Self, DecodeConfigError>
pub const fn standard(max_bits: u8) -> Result<Self, DecodeConfigError>
Accepts only RFC 7932 headers up to this bit count.
§Errors
Returns an error unless max_bits is in 10..=24.
Sourcepub const fn large(max_bits: u8) -> Result<Self, DecodeConfigError>
pub const fn large(max_bits: u8) -> Result<Self, DecodeConfigError>
Accepts standard and extended headers up to this bit count.
§Errors
Returns an error unless max_bits is in 10..=62.
Sourcepub const fn allows_large(self) -> bool
pub const fn allows_large(self) -> bool
Whether extended headers are accepted, including those below 25 bits.
Trait Implementations§
Source§impl Clone for WindowLimit
impl Clone for WindowLimit
Source§fn clone(&self) -> WindowLimit
fn clone(&self) -> WindowLimit
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for WindowLimit
Source§impl Debug for WindowLimit
impl Debug for WindowLimit
impl Eq for WindowLimit
Source§impl PartialEq for WindowLimit
impl PartialEq for WindowLimit
impl StructuralPartialEq for WindowLimit
Auto Trait Implementations§
impl Freeze for WindowLimit
impl RefUnwindSafe for WindowLimit
impl Send for WindowLimit
impl Sync for WindowLimit
impl Unpin for WindowLimit
impl UnsafeUnpin for WindowLimit
impl UnwindSafe for WindowLimit
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