pub struct DecompressionBudget(/* private fields */);Expand description
Upper bound on the bytes verify decodes to check payload integrity.
The budget bounds the work done beyond what listing already does: ZIP
entries and 7z blocks are charged their declared uncompressed size before
they are decoded, and for compressed TAR it bounds the read from the end
marker to decoder EOF. TAR entry content is never charged because listing
decodes it anyway. The default is a fixed 500 MiB, equal to the default
max_total_size; it does not follow a raised max_total_size.
§Examples
use exarch_core::DecompressionBudget;
assert!(DecompressionBudget::try_from_bytes(0).is_err());
let budget = DecompressionBudget::try_from_bytes(1024)?;
assert_eq!(budget.get(), 1024);
assert_eq!(DecompressionBudget::default(), DecompressionBudget::DEFAULT);Implementations§
Source§impl DecompressionBudget
impl DecompressionBudget
Sourcepub const fn new(bytes: NonZeroU64) -> Self
pub const fn new(bytes: NonZeroU64) -> Self
Creates a budget from a non-zero byte count.
Sourcepub fn try_from_bytes(bytes: u64) -> Result<Self>
pub fn try_from_bytes(bytes: u64) -> Result<Self>
Creates a budget from a byte count.
§Errors
Returns ArchiveError::InvalidConfiguration when
bytes is zero.
Trait Implementations§
Source§impl Clone for DecompressionBudget
impl Clone for DecompressionBudget
impl Copy for DecompressionBudget
Source§impl Debug for DecompressionBudget
impl Debug for DecompressionBudget
Source§impl Default for DecompressionBudget
impl Default for DecompressionBudget
impl Eq for DecompressionBudget
Source§impl Hash for DecompressionBudget
impl Hash for DecompressionBudget
Source§impl PartialEq for DecompressionBudget
impl PartialEq for DecompressionBudget
impl StructuralPartialEq for DecompressionBudget
Auto Trait Implementations§
impl Freeze for DecompressionBudget
impl RefUnwindSafe for DecompressionBudget
impl Send for DecompressionBudget
impl Sync for DecompressionBudget
impl Unpin for DecompressionBudget
impl UnsafeUnpin for DecompressionBudget
impl UnwindSafe for DecompressionBudget
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.