pub struct NonZero<T: ZeroablePrimitive>(/* private fields */);Implementations§
Source§impl<T: ZeroablePrimitive> NonZero<T>
impl<T: ZeroablePrimitive> NonZero<T>
Sourcepub const unsafe fn new_unchecked(value: T) -> Self
pub const unsafe fn new_unchecked(value: T) -> 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) -> T
pub const fn into_std(self) -> NonZero<T>
pub const fn from_std(value: NonZero<T>) -> Self
Trait Implementations§
Source§impl<T: Ord + ZeroablePrimitive> Ord for NonZero<T>
impl<T: Ord + ZeroablePrimitive> Ord for NonZero<T>
1.21.0 (const: unstable) · 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<T: PartialEq + ZeroablePrimitive> PartialEq for NonZero<T>
impl<T: PartialEq + ZeroablePrimitive> PartialEq for NonZero<T>
Source§impl<T: PartialOrd + ZeroablePrimitive> PartialOrd for NonZero<T>
impl<T: PartialOrd + ZeroablePrimitive> PartialOrd for NonZero<T>
impl<T: Eq + ConstParamTy_ + ZeroablePrimitive> ConstParamTy_ for NonZero<T>
impl<T: Copy + ZeroablePrimitive> Copy for NonZero<T>
impl<T: Eq + ZeroablePrimitive> Eq for NonZero<T>
impl<T: ZeroablePrimitive> StructuralPartialEq for NonZero<T>
Auto Trait Implementations§
impl<T> Freeze for NonZero<T>where
T: Freeze,
impl<T> RefUnwindSafe for NonZero<T>where
T: RefUnwindSafe,
impl<T> Send for NonZero<T>where
T: Send,
impl<T> Sync for NonZero<T>where
T: Sync,
impl<T> Unpin for NonZero<T>where
T: Unpin,
impl<T> UnsafeUnpin for NonZero<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for NonZero<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