Trait nonzero_ext::NonZeroAble
source · pub trait NonZeroAble {
type NonZero: NonZero;
// Required methods
fn into_nonzero(self) -> Option<Self::NonZero>;
unsafe fn into_nonzero_unchecked(self) -> Self::NonZero;
// Provided methods
fn as_nonzero(self) -> Option<Self::NonZero>
where Self: Sized { ... }
unsafe fn as_nonzero_unchecked(self) -> Self::NonZero
where Self: Sized { ... }
}
Expand description
A trait identifying integral types that have a non-zeroable equivalent.
Required Associated Types§
Required Methods§
sourcefn into_nonzero(self) -> Option<Self::NonZero>
fn into_nonzero(self) -> Option<Self::NonZero>
sourceunsafe fn into_nonzero_unchecked(self) -> Self::NonZero
unsafe fn into_nonzero_unchecked(self) -> Self::NonZero
Converts the integer to its non-zero equivalent without checking for zeroness.
This corresponds to the new_unchecked
function on the
corresponding NonZero type.
§Safety
The value must not be zero.
Provided Methods§
sourcefn as_nonzero(self) -> Option<Self::NonZero>where
Self: Sized,
👎Deprecated since 0.2.0: Renamed to into_nonzero
fn as_nonzero(self) -> Option<Self::NonZero>where
Self: Sized,
into_nonzero
sourceunsafe fn as_nonzero_unchecked(self) -> Self::NonZerowhere
Self: Sized,
👎Deprecated since 0.2.0: Renamed to into_nonzero_unchecked
unsafe fn as_nonzero_unchecked(self) -> Self::NonZerowhere
Self: Sized,
into_nonzero_unchecked
Converts the integer to its non-zero equivalent without checking for zeroness.
This corresponds to the new_unchecked
function on the
corresponding NonZero type.
§Safety
The value must not be zero.