1.28.0[−][src]Struct core::num::NonZeroUsize
An integer that is known not to equal zero.
This enables some memory layout optimization.
For example, Option<NonZeroUsize> is the same size as usize:
use std::mem::size_of; assert_eq!(size_of::<Option<std::num::NonZeroUsize>>(), size_of::<usize>());Run
Methods
impl NonZeroUsize[src]
impl NonZeroUsizepub const unsafe fn new_unchecked(n: usize) -> Self[src]
pub const unsafe fn new_unchecked(n: usize) -> Selfpub fn new(n: usize) -> Option<Self>[src]
pub fn new(n: usize) -> Option<Self>Create a non-zero if the given value is not zero.
pub fn get(self) -> usize[src]
pub fn get(self) -> usizeReturns the value as a primitive type.
Trait Implementations
impl Copy for NonZeroUsize[src]
impl Copy for NonZeroUsizeimpl PartialEq<NonZeroUsize> for NonZeroUsize[src]
impl PartialEq<NonZeroUsize> for NonZeroUsizefn eq(&self, other: &NonZeroUsize) -> bool[src]
fn eq(&self, other: &NonZeroUsize) -> boolfn ne(&self, other: &NonZeroUsize) -> bool[src]
fn ne(&self, other: &NonZeroUsize) -> boolimpl Eq for NonZeroUsize[src]
impl Eq for NonZeroUsizeimpl Ord for NonZeroUsize[src]
impl Ord for NonZeroUsizefn cmp(&self, other: &NonZeroUsize) -> Ordering[src]
fn cmp(&self, other: &NonZeroUsize) -> Orderingfn max(self, other: Self) -> Self where
Self: Sized, 1.21.0[src]
fn max(self, other: Self) -> Self where
Self: Sized, 1.21.0
[src]Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self where
Self: Sized, 1.21.0[src]
fn min(self, other: Self) -> Self where
Self: Sized, 1.21.0
[src]Compares and returns the minimum of two values. Read more
impl PartialOrd<NonZeroUsize> for NonZeroUsize[src]
impl PartialOrd<NonZeroUsize> for NonZeroUsizefn partial_cmp(&self, other: &NonZeroUsize) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &NonZeroUsize) -> Option<Ordering>fn lt(&self, other: &NonZeroUsize) -> bool[src]
fn lt(&self, other: &NonZeroUsize) -> boolfn le(&self, other: &NonZeroUsize) -> bool[src]
fn le(&self, other: &NonZeroUsize) -> boolfn gt(&self, other: &NonZeroUsize) -> bool[src]
fn gt(&self, other: &NonZeroUsize) -> boolfn ge(&self, other: &NonZeroUsize) -> bool[src]
fn ge(&self, other: &NonZeroUsize) -> boolimpl Clone for NonZeroUsize[src]
impl Clone for NonZeroUsizefn clone(&self) -> NonZeroUsize[src]
fn clone(&self) -> NonZeroUsizefn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0
[src]Performs copy-assignment from source. Read more
impl From<NonZeroUsize> for usize1.31.0[src]
impl From<NonZeroUsize> for usize1.31.0
[src]fn from(nonzero: NonZeroUsize) -> Self[src]
fn from(nonzero: NonZeroUsize) -> Selfimpl Hash for NonZeroUsize[src]
impl Hash for NonZeroUsizefn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash<__H: Hasher>(&self, state: &mut __H)fn hash_slice<H: Hasher>(data: &[Self], state: &mut H) where
Self: Sized, 1.3.0[src]
fn hash_slice<H: Hasher>(data: &[Self], state: &mut H) where
Self: Sized, 1.3.0
[src]Feeds a slice of this type into the given [Hasher]. Read more
impl Debug for NonZeroUsize[src]
impl Debug for NonZeroUsizeimpl Display for NonZeroUsize[src]
impl Display for NonZeroUsizeimpl Octal for NonZeroUsize[src]
impl Octal for NonZeroUsizeimpl Binary for NonZeroUsize[src]
impl Binary for NonZeroUsizeimpl LowerHex for NonZeroUsize[src]
impl LowerHex for NonZeroUsizeimpl UpperHex for NonZeroUsize[src]
impl UpperHex for NonZeroUsizeAuto Trait Implementations
impl Send for NonZeroUsize
impl Send for NonZeroUsizeimpl Sync for NonZeroUsize
impl Sync for NonZeroUsizeBlanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> From for T[src]
impl<T> From for Timpl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(Self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(Self) -> Result<U, <U as TryFrom<T>>::Error>impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
The type returned in the event of a conversion error.
fn try_from(U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(U) -> Result<T, <T as TryFrom<U>>::Error>impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut Self) -> &mut T[src]
fn borrow_mut(&mut Self) -> &mut Timpl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&Self) -> TypeId[src]
fn get_type_id(&Self) -> TypeId