pub struct MemoryLimit(/* private fields */);Expand description
The most bytes a MemorySink accepts, counted as its payload (file data,
hardlink copies, symlink targets) plus, for every entry, the bytes of its
path and MemorySink::ENTRY_OVERHEAD.
§Examples
use std::num::NonZeroU64;
use exarch_core::MemoryLimit;
assert_eq!(MemoryLimit::new(NonZeroU64::MIN).bytes().get(), 1);
assert_eq!(MemoryLimit::DEFAULT.bytes().get(), 500 * 1024 * 1024);Implementations§
Source§impl MemoryLimit
impl MemoryLimit
Sourcepub const fn new(bytes: NonZeroU64) -> Self
pub const fn new(bytes: NonZeroU64) -> Self
A limit of bytes.
Sourcepub const fn bytes(self) -> NonZeroU64
pub const fn bytes(self) -> NonZeroU64
The limit in bytes.
Sourcepub fn from_config<State>(config: &SecurityConfig<State>) -> Self
pub fn from_config<State>(config: &SecurityConfig<State>) -> Self
The limit equal to the config’s max_total_size (a zero quota becomes
one byte), so raising the extraction quota does not meet a second limit.
§Examples
use exarch_core::MemoryLimit;
use exarch_core::SecurityConfig;
let config = SecurityConfig::default().with_max_total_size(4096);
assert_eq!(MemoryLimit::from_config(&config).bytes().get(), 4096);Trait Implementations§
Source§impl Clone for MemoryLimit
impl Clone for MemoryLimit
impl Copy for MemoryLimit
Source§impl Debug for MemoryLimit
impl Debug for MemoryLimit
impl Eq for MemoryLimit
Source§impl PartialEq for MemoryLimit
impl PartialEq for MemoryLimit
impl StructuralPartialEq for MemoryLimit
Auto Trait Implementations§
impl Freeze for MemoryLimit
impl RefUnwindSafe for MemoryLimit
impl Send for MemoryLimit
impl Sync for MemoryLimit
impl Unpin for MemoryLimit
impl UnsafeUnpin for MemoryLimit
impl UnwindSafe for MemoryLimit
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.