pub enum Limit<T> {
Bounded(T),
Unbounded,
}Expand description
A positive bound, or no bound.
§Examples
use exarch_core::Limit;
use exarch_core::non_zero;
use std::num::NonZeroU64;
let bounded: Limit<NonZeroU64> = non_zero!(10).into();
assert!(bounded.admits(10));
assert!(!bounded.admits(11));
assert!(Limit::<NonZeroU64>::Unbounded.admits(u64::MAX));Variants§
Implementations§
Source§impl Limit<NonZeroU64>
impl Limit<NonZeroU64>
Sourcepub const fn ceiling(self) -> u64
pub const fn ceiling(self) -> u64
The bound as a number, u64::MAX when unbounded, for reporting.
Sourcepub fn parse(setting: ConfigSetting, value: u64) -> Result<Self>
pub fn parse(setting: ConfigSetting, value: u64) -> Result<Self>
Parses a runtime value, refusing zero.
§Errors
Returns ArchiveError::InvalidConfiguration naming setting when
value is zero.
Source§impl Limit<NonZeroUsize>
impl Limit<NonZeroUsize>
Sourcepub const fn ceiling(self) -> usize
pub const fn ceiling(self) -> usize
The bound as a number, usize::MAX when unbounded, for reporting.
Sourcepub fn parse(setting: ConfigSetting, value: usize) -> Result<Self>
pub fn parse(setting: ConfigSetting, value: usize) -> Result<Self>
Parses a runtime value, refusing zero.
§Errors
Returns ArchiveError::InvalidConfiguration naming setting when
value is zero.
Trait Implementations§
impl<T: Copy> Copy for Limit<T>
impl<T: Eq> Eq for Limit<T>
impl<T: PartialEq> StructuralPartialEq for Limit<T>
Auto Trait Implementations§
impl<T> Freeze for Limit<T>where
T: Freeze,
impl<T> RefUnwindSafe for Limit<T>where
T: RefUnwindSafe,
impl<T> Send for Limit<T>where
T: Send,
impl<T> Sync for Limit<T>where
T: Sync,
impl<T> Unpin for Limit<T>where
T: Unpin,
impl<T> UnsafeUnpin for Limit<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Limit<T>where
T: UnwindSafe,
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.