pub struct NonMaxUsize(/* private fields */);Expand description
A
usize
value that is known not to be
usize::MAX.
This enables some memory layout optimizations. For example,
Option<usize>
is the same size as
usize:
assert_eq!(
core::mem::size_of::<u32>(),
core::mem::size_of::<Option<NonMaxU32>>(),
);Implementations§
Source§impl NonMaxUsize
impl NonMaxUsize
Sourcepub fn new(x: usize) -> Option<NonMaxUsize>
pub fn new(x: usize) -> Option<NonMaxUsize>
Construct a new
usize
value.
Returns None when given
usize::MAX.
Sourcepub unsafe fn new_unchecked(x: usize) -> NonMaxUsize
pub unsafe fn new_unchecked(x: usize) -> NonMaxUsize
Trait Implementations§
Source§impl Clone for NonMaxUsize
impl Clone for NonMaxUsize
Source§fn clone(&self) -> NonMaxUsize
fn clone(&self) -> NonMaxUsize
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NonMaxUsize
impl Debug for NonMaxUsize
Source§impl Default for NonMaxUsize
impl Default for NonMaxUsize
Source§fn default() -> NonMaxUsize
fn default() -> NonMaxUsize
Returns the “default value” for a type. Read more
Source§impl Hash for NonMaxUsize
impl Hash for NonMaxUsize
Source§impl Ord for NonMaxUsize
impl Ord for NonMaxUsize
Source§fn cmp(&self, other: &NonMaxUsize) -> Ordering
fn cmp(&self, other: &NonMaxUsize) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for NonMaxUsize
impl PartialEq for NonMaxUsize
Source§impl PartialOrd for NonMaxUsize
impl PartialOrd for NonMaxUsize
impl Copy for NonMaxUsize
impl Eq for NonMaxUsize
impl StructuralPartialEq for NonMaxUsize
Auto Trait Implementations§
impl Freeze for NonMaxUsize
impl RefUnwindSafe for NonMaxUsize
impl Send for NonMaxUsize
impl Sync for NonMaxUsize
impl Unpin for NonMaxUsize
impl UnsafeUnpin for NonMaxUsize
impl UnwindSafe for NonMaxUsize
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.