pub struct DecodeOptions<'d> { /* private fields */ }Expand description
Configurable decompression: an output-size limit, a maximum accepted window log, and an optional dictionary.
use libzstd_bitexact_rs::DecodeOptions;
let frame = [0x28, 0xB5, 0x2F, 0xFD, 0x20, 0x05, 0x2B, 0x00, 0x00, b'a'];
let out = DecodeOptions::new().limit(1 << 20).decompress(&frame).unwrap();
assert_eq!(out, b"aaaaa");Implementations§
Source§impl<'d> DecodeOptions<'d>
impl<'d> DecodeOptions<'d>
Sourcepub fn new() -> Self
pub fn new() -> Self
Default options: no output limit, window log up to WINDOW_LOG_MAX,
no dictionary.
Sourcepub fn limit(self, limit: usize) -> Self
pub fn limit(self, limit: usize) -> Self
Fail with Error::OutputTooLarge once the output would exceed
limit bytes. Use this on untrusted input to defuse decompression
bombs.
Sourcepub fn window_log_max(self, window_log_max: u32) -> Self
pub fn window_log_max(self, window_log_max: u32) -> Self
Reject frames whose declared window log exceeds window_log_max
(ZSTD_d_windowLogMax). Values above WINDOW_LOG_MAX are treated as
WINDOW_LOG_MAX.
Sourcepub fn dictionary(self, dictionary: &'d Dictionary) -> Self
pub fn dictionary(self, dictionary: &'d Dictionary) -> Self
Decode using dictionary as window history and entropy-table seed
(ZSTD_decompress_usingDict). The dictionary applies to every frame in
the input.
Trait Implementations§
Source§impl<'d> Clone for DecodeOptions<'d>
impl<'d> Clone for DecodeOptions<'d>
Source§fn clone(&self) -> DecodeOptions<'d>
fn clone(&self) -> DecodeOptions<'d>
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 moreAuto Trait Implementations§
impl<'d> Freeze for DecodeOptions<'d>
impl<'d> RefUnwindSafe for DecodeOptions<'d>
impl<'d> Send for DecodeOptions<'d>
impl<'d> Sync for DecodeOptions<'d>
impl<'d> Unpin for DecodeOptions<'d>
impl<'d> UnsafeUnpin for DecodeOptions<'d>
impl<'d> UnwindSafe for DecodeOptions<'d>
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