pub struct DecodeStreamConfig { /* private fields */ }Expand description
Per-operation output validation.
Defaults to OutputSize::Unknown. A mismatch fails the operation even
when the compressed input is otherwise valid.
§Examples
use mbrotli::{DecodeOperation, DecodeStreamConfig, DecoderConfig, Decompressor, OutputSize};
let stream = DecodeStreamConfig::default().with_output_size(OutputSize::Exact(0));
assert_eq!(stream.output_size(), OutputSize::Exact(0));
assert_eq!(stream, DecodeStreamConfig::from(OutputSize::Exact(0)));
let mut decoder = Decompressor::new(DecoderConfig::default())?;
let mut session = decoder.start(stream)?;
session.process(&[0x3b], &mut [], DecodeOperation::Finish)?;
assert!(session.is_finished());Implementations§
Source§impl DecodeStreamConfig
impl DecodeStreamConfig
Sourcepub const fn with_output_size(self, value: OutputSize) -> Self
pub const fn with_output_size(self, value: OutputSize) -> Self
Sets the exact size contract, or disables it with Unknown.
Sourcepub const fn output_size(&self) -> OutputSize
pub const fn output_size(&self) -> OutputSize
Returns the expected output size.
Trait Implementations§
Source§impl Clone for DecodeStreamConfig
impl Clone for DecodeStreamConfig
Source§fn clone(&self) -> DecodeStreamConfig
fn clone(&self) -> DecodeStreamConfig
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 DecodeStreamConfig
Source§impl Debug for DecodeStreamConfig
impl Debug for DecodeStreamConfig
Source§impl Default for DecodeStreamConfig
impl Default for DecodeStreamConfig
Source§fn default() -> DecodeStreamConfig
fn default() -> DecodeStreamConfig
Returns the “default value” for a type. Read more
impl Eq for DecodeStreamConfig
Source§impl From<OutputSize> for DecodeStreamConfig
impl From<OutputSize> for DecodeStreamConfig
Source§fn from(size: OutputSize) -> Self
fn from(size: OutputSize) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DecodeStreamConfig
impl PartialEq for DecodeStreamConfig
impl StructuralPartialEq for DecodeStreamConfig
Auto Trait Implementations§
impl Freeze for DecodeStreamConfig
impl RefUnwindSafe for DecodeStreamConfig
impl Send for DecodeStreamConfig
impl Sync for DecodeStreamConfig
impl Unpin for DecodeStreamConfig
impl UnsafeUnpin for DecodeStreamConfig
impl UnwindSafe for DecodeStreamConfig
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