pub struct NonZeroUsize(/* private fields */);
Implementations§
Source§impl NonZeroUsize
impl NonZeroUsize
Sourcepub const fn new(value: usize) -> Option<Self>
pub const fn new(value: usize) -> Option<Self>
Creates a non-zero if the given value is not zero.
Sourcepub const unsafe fn new_unchecked(value: usize) -> Self
pub const unsafe fn new_unchecked(value: usize) -> Self
Creates a non-zero without checking whether the value is non-zero. This results in undefined behaviour if the value is zero.
§Safety
The value must not be zero.
pub const fn get(self) -> usize
pub const fn into_std(self) -> NonZeroUsize
pub const fn from_std(value: NonZeroUsize) -> Self
Trait Implementations§
Source§impl Clone for NonZeroUsize
impl Clone for NonZeroUsize
Source§fn clone(&self) -> NonZeroUsize
fn clone(&self) -> NonZeroUsize
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 NonZeroUsize
impl Debug for NonZeroUsize
Source§impl Display for NonZeroUsize
impl Display for NonZeroUsize
Source§impl Hash for NonZeroUsize
impl Hash for NonZeroUsize
Source§impl Ord for NonZeroUsize
impl Ord for NonZeroUsize
Source§fn cmp(&self, other: &NonZeroUsize) -> Ordering
fn cmp(&self, other: &NonZeroUsize) -> 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 NonZeroUsize
impl PartialEq for NonZeroUsize
Source§impl PartialOrd for NonZeroUsize
impl PartialOrd for NonZeroUsize
impl ConstParamTy_ for NonZeroUsize
impl Copy for NonZeroUsize
impl Eq for NonZeroUsize
impl StructuralPartialEq for NonZeroUsize
impl UnsizedConstParamTy for NonZeroUsize
Auto Trait Implementations§
impl Freeze for NonZeroUsize
impl RefUnwindSafe for NonZeroUsize
impl Send for NonZeroUsize
impl Sync for NonZeroUsize
impl Unpin for NonZeroUsize
impl UnwindSafe for NonZeroUsize
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