Struct NonZero
struct NonZero<T: ZeroablePrimitive>(_)
A value that is known not to equal zero.
This enables some memory layout optimization.
For example, Option<NonZero<u32>> is the same size as u32:
use ;
assert_eq!;
Layout
NonZero<T> is guaranteed to have the same layout and bit validity as T
with the exception that the all-zero bit pattern is invalid.
Option<NonZero<T>> is guaranteed to be compatible with T, including in
FFI.
Thanks to the null pointer optimization, NonZero<T> and
Option<NonZero<T>> are guaranteed to have the same size and alignment:
use NonZero;
assert_eq!;
assert_eq!;
Note on generic usage
NonZero<T> can only be used with some standard library primitive types
(such as u8, i32, and etc.). The type parameter T must implement the
internal trait ZeroablePrimitive, which is currently permanently unstable
and cannot be implemented by users. Therefore, you cannot use NonZero<T>
with your own types, nor can you implement traits for all NonZero<T>,
only for concrete types.
Implementations
impl NonZero<i128>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI128; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI128; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn abs(self: Self) -> SelfComputes the absolute value of self. See
i128::absfor documentation on overflow behavior.Example
# use NonZero; # # #const fn checked_abs(self: Self) -> Option<Self>Checked absolute value. Checks for overflow and returns
Noneifself == NonZero::<i128>::MIN. The result cannot be zero.Example
# use NonZero; # # #const fn overflowing_abs(self: Self) -> (Self, bool)Computes the absolute value of self, with overflow information, see
i128::overflowing_abs.Example
# use NonZero; # # #const fn saturating_abs(self: Self) -> SelfSaturating absolute value, see
i128::saturating_abs.Example
# use NonZero; # # #const fn wrapping_abs(self: Self) -> SelfWrapping absolute value, see
i128::wrapping_abs.Example
# use NonZero; # # #const fn unsigned_abs(self: Self) -> NonZero<u128>Computes the absolute value of self without any wrapping or panicking.
Example
# use NonZero; # # #const fn is_positive(self: Self) -> boolReturns
trueifselfis positive andfalseif the number is negative.Example
# use NonZero; # # #const fn is_negative(self: Self) -> boolReturns
trueifselfis negative andfalseif the number is positive.Example
# use NonZero; # # #const fn checked_neg(self: Self) -> Option<Self>Checked negation. Computes
-self, returningNoneifself == NonZero::<i128>::MIN.Example
# use NonZero; # # #const fn overflowing_neg(self: Self) -> (Self, bool)Negates self, overflowing if this is equal to the minimum value.
See
i128::overflowing_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn saturating_neg(self: Self) -> SelfSaturating negation. Computes
-self, returning [NonZero::<i128>::MAX] ifself == NonZero::<i128>::MINinstead of overflowing.Example
# use NonZero; # # #const fn wrapping_neg(self: Self) -> SelfWrapping (modular) negation. Computes
-self, wrapping around at the boundary of the type.See
i128::wrapping_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn cast_unsigned(self: Self) -> NonZero<u128>Returns the bit pattern of
selfreinterpreted as an unsigned integer of the same size.Examples
# use NonZero; let n = new.unwrap; assert_eq!;const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<i128>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > i128::MAX, orself * rhs < i128::MIN.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<i128>::MIN] or [NonZero::<i128>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<i16>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI16; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI16; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn abs(self: Self) -> SelfComputes the absolute value of self. See
i16::absfor documentation on overflow behavior.Example
# use NonZero; # # #const fn checked_abs(self: Self) -> Option<Self>Checked absolute value. Checks for overflow and returns
Noneifself == NonZero::<i16>::MIN. The result cannot be zero.Example
# use NonZero; # # #const fn overflowing_abs(self: Self) -> (Self, bool)Computes the absolute value of self, with overflow information, see
i16::overflowing_abs.Example
# use NonZero; # # #const fn saturating_abs(self: Self) -> SelfSaturating absolute value, see
i16::saturating_abs.Example
# use NonZero; # # #const fn wrapping_abs(self: Self) -> SelfWrapping absolute value, see
i16::wrapping_abs.Example
# use NonZero; # # #const fn unsigned_abs(self: Self) -> NonZero<u16>Computes the absolute value of self without any wrapping or panicking.
Example
# use NonZero; # # #const fn is_positive(self: Self) -> boolReturns
trueifselfis positive andfalseif the number is negative.Example
# use NonZero; # # #const fn is_negative(self: Self) -> boolReturns
trueifselfis negative andfalseif the number is positive.Example
# use NonZero; # # #const fn checked_neg(self: Self) -> Option<Self>Checked negation. Computes
-self, returningNoneifself == NonZero::<i16>::MIN.Example
# use NonZero; # # #const fn overflowing_neg(self: Self) -> (Self, bool)Negates self, overflowing if this is equal to the minimum value.
See
i16::overflowing_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn saturating_neg(self: Self) -> SelfSaturating negation. Computes
-self, returning [NonZero::<i16>::MAX] ifself == NonZero::<i16>::MINinstead of overflowing.Example
# use NonZero; # # #const fn wrapping_neg(self: Self) -> SelfWrapping (modular) negation. Computes
-self, wrapping around at the boundary of the type.See
i16::wrapping_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn cast_unsigned(self: Self) -> NonZero<u16>Returns the bit pattern of
selfreinterpreted as an unsigned integer of the same size.Examples
# use NonZero; let n = new.unwrap; assert_eq!;const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<i16>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > i16::MAX, orself * rhs < i16::MIN.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<i16>::MIN] or [NonZero::<i16>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<i32>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI32; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI32; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn abs(self: Self) -> SelfComputes the absolute value of self. See
i32::absfor documentation on overflow behavior.Example
# use NonZero; # # #const fn checked_abs(self: Self) -> Option<Self>Checked absolute value. Checks for overflow and returns
Noneifself == NonZero::<i32>::MIN. The result cannot be zero.Example
# use NonZero; # # #const fn overflowing_abs(self: Self) -> (Self, bool)Computes the absolute value of self, with overflow information, see
i32::overflowing_abs.Example
# use NonZero; # # #const fn saturating_abs(self: Self) -> SelfSaturating absolute value, see
i32::saturating_abs.Example
# use NonZero; # # #const fn wrapping_abs(self: Self) -> SelfWrapping absolute value, see
i32::wrapping_abs.Example
# use NonZero; # # #const fn unsigned_abs(self: Self) -> NonZero<u32>Computes the absolute value of self without any wrapping or panicking.
Example
# use NonZero; # # #const fn is_positive(self: Self) -> boolReturns
trueifselfis positive andfalseif the number is negative.Example
# use NonZero; # # #const fn is_negative(self: Self) -> boolReturns
trueifselfis negative andfalseif the number is positive.Example
# use NonZero; # # #const fn checked_neg(self: Self) -> Option<Self>Checked negation. Computes
-self, returningNoneifself == NonZero::<i32>::MIN.Example
# use NonZero; # # #const fn overflowing_neg(self: Self) -> (Self, bool)Negates self, overflowing if this is equal to the minimum value.
See
i32::overflowing_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn saturating_neg(self: Self) -> SelfSaturating negation. Computes
-self, returning [NonZero::<i32>::MAX] ifself == NonZero::<i32>::MINinstead of overflowing.Example
# use NonZero; # # #const fn wrapping_neg(self: Self) -> SelfWrapping (modular) negation. Computes
-self, wrapping around at the boundary of the type.See
i32::wrapping_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn cast_unsigned(self: Self) -> NonZero<u32>Returns the bit pattern of
selfreinterpreted as an unsigned integer of the same size.Examples
# use NonZero; let n = new.unwrap; assert_eq!;const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<i32>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > i32::MAX, orself * rhs < i32::MIN.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<i32>::MIN] or [NonZero::<i32>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<i64>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI64; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI64; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn abs(self: Self) -> SelfComputes the absolute value of self. See
i64::absfor documentation on overflow behavior.Example
# use NonZero; # # #const fn checked_abs(self: Self) -> Option<Self>Checked absolute value. Checks for overflow and returns
Noneifself == NonZero::<i64>::MIN. The result cannot be zero.Example
# use NonZero; # # #const fn overflowing_abs(self: Self) -> (Self, bool)Computes the absolute value of self, with overflow information, see
i64::overflowing_abs.Example
# use NonZero; # # #const fn saturating_abs(self: Self) -> SelfSaturating absolute value, see
i64::saturating_abs.Example
# use NonZero; # # #const fn wrapping_abs(self: Self) -> SelfWrapping absolute value, see
i64::wrapping_abs.Example
# use NonZero; # # #const fn unsigned_abs(self: Self) -> NonZero<u64>Computes the absolute value of self without any wrapping or panicking.
Example
# use NonZero; # # #const fn is_positive(self: Self) -> boolReturns
trueifselfis positive andfalseif the number is negative.Example
# use NonZero; # # #const fn is_negative(self: Self) -> boolReturns
trueifselfis negative andfalseif the number is positive.Example
# use NonZero; # # #const fn checked_neg(self: Self) -> Option<Self>Checked negation. Computes
-self, returningNoneifself == NonZero::<i64>::MIN.Example
# use NonZero; # # #const fn overflowing_neg(self: Self) -> (Self, bool)Negates self, overflowing if this is equal to the minimum value.
See
i64::overflowing_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn saturating_neg(self: Self) -> SelfSaturating negation. Computes
-self, returning [NonZero::<i64>::MAX] ifself == NonZero::<i64>::MINinstead of overflowing.Example
# use NonZero; # # #const fn wrapping_neg(self: Self) -> SelfWrapping (modular) negation. Computes
-self, wrapping around at the boundary of the type.See
i64::wrapping_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn cast_unsigned(self: Self) -> NonZero<u64>Returns the bit pattern of
selfreinterpreted as an unsigned integer of the same size.Examples
# use NonZero; let n = new.unwrap; assert_eq!;const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<i64>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > i64::MAX, orself * rhs < i64::MIN.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<i64>::MIN] or [NonZero::<i64>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<i8>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI8; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroI8; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn abs(self: Self) -> SelfComputes the absolute value of self. See
i8::absfor documentation on overflow behavior.Example
# use NonZero; # # #const fn checked_abs(self: Self) -> Option<Self>Checked absolute value. Checks for overflow and returns
Noneifself == NonZero::<i8>::MIN. The result cannot be zero.Example
# use NonZero; # # #const fn overflowing_abs(self: Self) -> (Self, bool)Computes the absolute value of self, with overflow information, see
i8::overflowing_abs.Example
# use NonZero; # # #const fn saturating_abs(self: Self) -> SelfSaturating absolute value, see
i8::saturating_abs.Example
# use NonZero; # # #const fn wrapping_abs(self: Self) -> SelfWrapping absolute value, see
i8::wrapping_abs.Example
# use NonZero; # # #const fn unsigned_abs(self: Self) -> NonZero<u8>Computes the absolute value of self without any wrapping or panicking.
Example
# use NonZero; # # #const fn is_positive(self: Self) -> boolReturns
trueifselfis positive andfalseif the number is negative.Example
# use NonZero; # # #const fn is_negative(self: Self) -> boolReturns
trueifselfis negative andfalseif the number is positive.Example
# use NonZero; # # #const fn checked_neg(self: Self) -> Option<Self>Checked negation. Computes
-self, returningNoneifself == NonZero::<i8>::MIN.Example
# use NonZero; # # #const fn overflowing_neg(self: Self) -> (Self, bool)Negates self, overflowing if this is equal to the minimum value.
See
i8::overflowing_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn saturating_neg(self: Self) -> SelfSaturating negation. Computes
-self, returning [NonZero::<i8>::MAX] ifself == NonZero::<i8>::MINinstead of overflowing.Example
# use NonZero; # # #const fn wrapping_neg(self: Self) -> SelfWrapping (modular) negation. Computes
-self, wrapping around at the boundary of the type.See
i8::wrapping_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn cast_unsigned(self: Self) -> NonZero<u8>Returns the bit pattern of
selfreinterpreted as an unsigned integer of the same size.Examples
# use NonZero; let n = new.unwrap; assert_eq!;const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<i8>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > i8::MAX, orself * rhs < i8::MIN.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<i8>::MIN] or [NonZero::<i8>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<isize>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroIsize; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroIsize; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn abs(self: Self) -> SelfComputes the absolute value of self. See
isize::absfor documentation on overflow behavior.Example
# use NonZero; # # #const fn checked_abs(self: Self) -> Option<Self>Checked absolute value. Checks for overflow and returns
Noneifself == NonZero::<isize>::MIN. The result cannot be zero.Example
# use NonZero; # # #const fn overflowing_abs(self: Self) -> (Self, bool)Computes the absolute value of self, with overflow information, see
isize::overflowing_abs.Example
# use NonZero; # # #const fn saturating_abs(self: Self) -> SelfSaturating absolute value, see
isize::saturating_abs.Example
# use NonZero; # # #const fn wrapping_abs(self: Self) -> SelfWrapping absolute value, see
isize::wrapping_abs.Example
# use NonZero; # # #const fn unsigned_abs(self: Self) -> NonZero<usize>Computes the absolute value of self without any wrapping or panicking.
Example
# use NonZero; # # #const fn is_positive(self: Self) -> boolReturns
trueifselfis positive andfalseif the number is negative.Example
# use NonZero; # # #const fn is_negative(self: Self) -> boolReturns
trueifselfis negative andfalseif the number is positive.Example
# use NonZero; # # #const fn checked_neg(self: Self) -> Option<Self>Checked negation. Computes
-self, returningNoneifself == NonZero::<isize>::MIN.Example
# use NonZero; # # #const fn overflowing_neg(self: Self) -> (Self, bool)Negates self, overflowing if this is equal to the minimum value.
See
isize::overflowing_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn saturating_neg(self: Self) -> SelfSaturating negation. Computes
-self, returning [NonZero::<isize>::MAX] ifself == NonZero::<isize>::MINinstead of overflowing.Example
# use NonZero; # # #const fn wrapping_neg(self: Self) -> SelfWrapping (modular) negation. Computes
-self, wrapping around at the boundary of the type.See
isize::wrapping_negfor documentation on overflow behavior.Example
# use NonZero; # # #const fn cast_unsigned(self: Self) -> NonZero<usize>Returns the bit pattern of
selfreinterpreted as an unsigned integer of the same size.Examples
# use NonZero; let n = new.unwrap; assert_eq!;const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<isize>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > isize::MAX, orself * rhs < isize::MIN.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<isize>::MIN] or [NonZero::<isize>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+or-sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<u128>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU128; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU128; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn checked_add(self: Self, other: u128) -> Option<Self>Adds an unsigned integer to a non-zero value. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_add(self: Self, other: u128) -> SelfAdds an unsigned integer to a non-zero value. Return [
NonZero::<u128>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_add(self: Self, other: u128) -> SelfAdds an unsigned integer to a non-zero value, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self + rhs > u128::MAX.Examples
# use NonZero; # # #const fn checked_next_power_of_two(self: Self) -> Option<Self>Returns the smallest power of two greater than or equal to
self. Checks for overflow and returnsNoneif the next power of two is greater than the type’s maximum value. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn ilog2(self: Self) -> u32Returns the base 2 logarithm of the number, rounded down.
This is the same operation as
u128::ilog2, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn ilog10(self: Self) -> u32Returns the base 10 logarithm of the number, rounded down.
This is the same operation as
u128::ilog10, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn midpoint(self: Self, rhs: Self) -> SelfCalculates the midpoint (average) between
selfandrhs.midpoint(a, b)is(a + b) >> 1as if it were performed in a sufficiently-large signed integral type. This implies that the result is always rounded towards negative infinity and that no overflow will ever occur.Examples
# use NonZero; # # #const fn is_power_of_two(self: Self) -> boolReturns
trueif and only ifself == (1 << k)for somek.On many architectures, this function can perform better than
is_power_of_two()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isqrt(self: Self) -> SelfReturns the square root of the number, rounded down.
Examples
# use NonZero; # # #const fn cast_signed(self: Self) -> NonZero<i128>Returns the bit pattern of
selfreinterpreted as a signed integer of the same size.Examples
# use NonZero; let n = MAX; assert_eq!;const fn bit_width(self: Self) -> NonZero<u32>Returns the minimum number of bits required to represent
self.Examples
# use NonZero; # # #const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<u128>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > u128::MAX.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<u128>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<u128>
const fn div_ceil(self: Self, rhs: Self) -> SelfCalculates the quotient of
selfandrhs, rounding the result towards positive infinity.The result is guaranteed to be non-zero.
Examples
# use NonZero; let one = new.unwrap; let max = new.unwrap; assert_eq!; let two = new.unwrap; let three = new.unwrap; assert_eq!;
impl NonZero<u16>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU16; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU16; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn checked_add(self: Self, other: u16) -> Option<Self>Adds an unsigned integer to a non-zero value. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_add(self: Self, other: u16) -> SelfAdds an unsigned integer to a non-zero value. Return [
NonZero::<u16>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_add(self: Self, other: u16) -> SelfAdds an unsigned integer to a non-zero value, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self + rhs > u16::MAX.Examples
# use NonZero; # # #const fn checked_next_power_of_two(self: Self) -> Option<Self>Returns the smallest power of two greater than or equal to
self. Checks for overflow and returnsNoneif the next power of two is greater than the type’s maximum value. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn ilog2(self: Self) -> u32Returns the base 2 logarithm of the number, rounded down.
This is the same operation as
u16::ilog2, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn ilog10(self: Self) -> u32Returns the base 10 logarithm of the number, rounded down.
This is the same operation as
u16::ilog10, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn midpoint(self: Self, rhs: Self) -> SelfCalculates the midpoint (average) between
selfandrhs.midpoint(a, b)is(a + b) >> 1as if it were performed in a sufficiently-large signed integral type. This implies that the result is always rounded towards negative infinity and that no overflow will ever occur.Examples
# use NonZero; # # #const fn is_power_of_two(self: Self) -> boolReturns
trueif and only ifself == (1 << k)for somek.On many architectures, this function can perform better than
is_power_of_two()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isqrt(self: Self) -> SelfReturns the square root of the number, rounded down.
Examples
# use NonZero; # # #const fn cast_signed(self: Self) -> NonZero<i16>Returns the bit pattern of
selfreinterpreted as a signed integer of the same size.Examples
# use NonZero; let n = MAX; assert_eq!;const fn bit_width(self: Self) -> NonZero<u32>Returns the minimum number of bits required to represent
self.Examples
# use NonZero; # # #const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<u16>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > u16::MAX.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<u16>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<u16>
const fn div_ceil(self: Self, rhs: Self) -> SelfCalculates the quotient of
selfandrhs, rounding the result towards positive infinity.The result is guaranteed to be non-zero.
Examples
# use NonZero; let one = new.unwrap; let max = new.unwrap; assert_eq!; let two = new.unwrap; let three = new.unwrap; assert_eq!;
impl NonZero<u32>
const fn div_ceil(self: Self, rhs: Self) -> SelfCalculates the quotient of
selfandrhs, rounding the result towards positive infinity.The result is guaranteed to be non-zero.
Examples
# use NonZero; let one = new.unwrap; let max = new.unwrap; assert_eq!; let two = new.unwrap; let three = new.unwrap; assert_eq!;
impl NonZero<u32>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU32; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU32; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn checked_add(self: Self, other: u32) -> Option<Self>Adds an unsigned integer to a non-zero value. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_add(self: Self, other: u32) -> SelfAdds an unsigned integer to a non-zero value. Return [
NonZero::<u32>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_add(self: Self, other: u32) -> SelfAdds an unsigned integer to a non-zero value, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self + rhs > u32::MAX.Examples
# use NonZero; # # #const fn checked_next_power_of_two(self: Self) -> Option<Self>Returns the smallest power of two greater than or equal to
self. Checks for overflow and returnsNoneif the next power of two is greater than the type’s maximum value. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn ilog2(self: Self) -> u32Returns the base 2 logarithm of the number, rounded down.
This is the same operation as
u32::ilog2, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn ilog10(self: Self) -> u32Returns the base 10 logarithm of the number, rounded down.
This is the same operation as
u32::ilog10, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn midpoint(self: Self, rhs: Self) -> SelfCalculates the midpoint (average) between
selfandrhs.midpoint(a, b)is(a + b) >> 1as if it were performed in a sufficiently-large signed integral type. This implies that the result is always rounded towards negative infinity and that no overflow will ever occur.Examples
# use NonZero; # # #const fn is_power_of_two(self: Self) -> boolReturns
trueif and only ifself == (1 << k)for somek.On many architectures, this function can perform better than
is_power_of_two()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isqrt(self: Self) -> SelfReturns the square root of the number, rounded down.
Examples
# use NonZero; # # #const fn cast_signed(self: Self) -> NonZero<i32>Returns the bit pattern of
selfreinterpreted as a signed integer of the same size.Examples
# use NonZero; let n = MAX; assert_eq!;const fn bit_width(self: Self) -> NonZero<u32>Returns the minimum number of bits required to represent
self.Examples
# use NonZero; # # #const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<u32>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > u32::MAX.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<u32>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<u64>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU64; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU64; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn checked_add(self: Self, other: u64) -> Option<Self>Adds an unsigned integer to a non-zero value. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_add(self: Self, other: u64) -> SelfAdds an unsigned integer to a non-zero value. Return [
NonZero::<u64>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_add(self: Self, other: u64) -> SelfAdds an unsigned integer to a non-zero value, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self + rhs > u64::MAX.Examples
# use NonZero; # # #const fn checked_next_power_of_two(self: Self) -> Option<Self>Returns the smallest power of two greater than or equal to
self. Checks for overflow and returnsNoneif the next power of two is greater than the type’s maximum value. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn ilog2(self: Self) -> u32Returns the base 2 logarithm of the number, rounded down.
This is the same operation as
u64::ilog2, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn ilog10(self: Self) -> u32Returns the base 10 logarithm of the number, rounded down.
This is the same operation as
u64::ilog10, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn midpoint(self: Self, rhs: Self) -> SelfCalculates the midpoint (average) between
selfandrhs.midpoint(a, b)is(a + b) >> 1as if it were performed in a sufficiently-large signed integral type. This implies that the result is always rounded towards negative infinity and that no overflow will ever occur.Examples
# use NonZero; # # #const fn is_power_of_two(self: Self) -> boolReturns
trueif and only ifself == (1 << k)for somek.On many architectures, this function can perform better than
is_power_of_two()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isqrt(self: Self) -> SelfReturns the square root of the number, rounded down.
Examples
# use NonZero; # # #const fn cast_signed(self: Self) -> NonZero<i64>Returns the bit pattern of
selfreinterpreted as a signed integer of the same size.Examples
# use NonZero; let n = MAX; assert_eq!;const fn bit_width(self: Self) -> NonZero<u32>Returns the minimum number of bits required to represent
self.Examples
# use NonZero; # # #const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<u64>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > u64::MAX.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<u64>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<u64>
const fn div_ceil(self: Self, rhs: Self) -> SelfCalculates the quotient of
selfandrhs, rounding the result towards positive infinity.The result is guaranteed to be non-zero.
Examples
# use NonZero; let one = new.unwrap; let max = new.unwrap; assert_eq!; let two = new.unwrap; let three = new.unwrap; assert_eq!;
impl NonZero<u8>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU8; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroU8; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn checked_add(self: Self, other: u8) -> Option<Self>Adds an unsigned integer to a non-zero value. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_add(self: Self, other: u8) -> SelfAdds an unsigned integer to a non-zero value. Return [
NonZero::<u8>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_add(self: Self, other: u8) -> SelfAdds an unsigned integer to a non-zero value, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self + rhs > u8::MAX.Examples
# use NonZero; # # #const fn checked_next_power_of_two(self: Self) -> Option<Self>Returns the smallest power of two greater than or equal to
self. Checks for overflow and returnsNoneif the next power of two is greater than the type’s maximum value. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn ilog2(self: Self) -> u32Returns the base 2 logarithm of the number, rounded down.
This is the same operation as
u8::ilog2, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn ilog10(self: Self) -> u32Returns the base 10 logarithm of the number, rounded down.
This is the same operation as
u8::ilog10, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn midpoint(self: Self, rhs: Self) -> SelfCalculates the midpoint (average) between
selfandrhs.midpoint(a, b)is(a + b) >> 1as if it were performed in a sufficiently-large signed integral type. This implies that the result is always rounded towards negative infinity and that no overflow will ever occur.Examples
# use NonZero; # # #const fn is_power_of_two(self: Self) -> boolReturns
trueif and only ifself == (1 << k)for somek.On many architectures, this function can perform better than
is_power_of_two()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isqrt(self: Self) -> SelfReturns the square root of the number, rounded down.
Examples
# use NonZero; # # #const fn cast_signed(self: Self) -> NonZero<i8>Returns the bit pattern of
selfreinterpreted as a signed integer of the same size.Examples
# use NonZero; let n = MAX; assert_eq!;const fn bit_width(self: Self) -> NonZero<u32>Returns the minimum number of bits required to represent
self.Examples
# use NonZero; # # #const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<u8>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > u8::MAX.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<u8>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<u8>
const fn div_ceil(self: Self, rhs: Self) -> SelfCalculates the quotient of
selfandrhs, rounding the result towards positive infinity.The result is guaranteed to be non-zero.
Examples
# use NonZero; let one = new.unwrap; let max = new.unwrap; assert_eq!; let two = new.unwrap; let three = new.unwrap; assert_eq!;
impl NonZero<usize>
const fn leading_zeros(self: Self) -> u32Returns the number of leading zeros in the binary representation of
self.On many architectures, this function can perform better than
leading_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn trailing_zeros(self: Self) -> u32Returns the number of trailing zeros in the binary representation of
self.On many architectures, this function can perform better than
trailing_zeros()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isolate_highest_one(self: Self) -> SelfReturns
selfwith only the most significant bit set.Example
# use NonZero; # #const fn isolate_lowest_one(self: Self) -> SelfReturns
selfwith only the least significant bit set.Example
# use NonZero; # #const fn highest_one(self: Self) -> u32Returns the index of the highest bit set to one in
self.Examples
# use NonZero; # #const fn lowest_one(self: Self) -> u32Returns the index of the lowest bit set to one in
self.Examples
# use NonZero; # #const fn count_ones(self: Self) -> NonZero<u32>Returns the number of ones in the binary representation of
self.Examples
# use NonZero; # # #const fn rotate_left(self: Self, n: u32) -> SelfShifts the bits to the left by a specified amount,
n, wrapping the truncated bits to the end of the resulting integer.Please note this isn't the same operation as the
<<shifting operator!Examples
# use NonZero; # # #const fn rotate_right(self: Self, n: u32) -> SelfShifts the bits to the right by a specified amount,
n, wrapping the truncated bits to the beginning of the resulting integer.Please note this isn't the same operation as the
>>shifting operator!Examples
# use NonZero; # # #const fn swap_bytes(self: Self) -> SelfReverses the byte order of the integer.
Examples
# use NonZero; # # #const fn reverse_bits(self: Self) -> SelfReverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Examples
# use NonZero; # # #const fn from_be(x: Self) -> SelfConverts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; use NonZeroUsize; # # #const fn from_le(x: Self) -> SelfConverts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; use NonZeroUsize; # # #const fn to_be(self: Self) -> SelfConverts
selfto big endian from the target's endianness.On big endian this is a no-op. On little endian the bytes are swapped.
Examples
# use NonZero; # # #const fn to_le(self: Self) -> SelfConverts
selfto little endian from the target's endianness.On little endian this is a no-op. On big endian the bytes are swapped.
Examples
# use NonZero; # # #const fn checked_add(self: Self, other: usize) -> Option<Self>Adds an unsigned integer to a non-zero value. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_add(self: Self, other: usize) -> SelfAdds an unsigned integer to a non-zero value. Return [
NonZero::<usize>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_add(self: Self, other: usize) -> SelfAdds an unsigned integer to a non-zero value, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self + rhs > usize::MAX.Examples
# use NonZero; # # #const fn checked_next_power_of_two(self: Self) -> Option<Self>Returns the smallest power of two greater than or equal to
self. Checks for overflow and returnsNoneif the next power of two is greater than the type’s maximum value. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn ilog2(self: Self) -> u32Returns the base 2 logarithm of the number, rounded down.
This is the same operation as
usize::ilog2, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn ilog10(self: Self) -> u32Returns the base 10 logarithm of the number, rounded down.
This is the same operation as
usize::ilog10, except that it has no failure cases to worry about since this value can never be zero.Examples
# use NonZero; # # #const fn midpoint(self: Self, rhs: Self) -> SelfCalculates the midpoint (average) between
selfandrhs.midpoint(a, b)is(a + b) >> 1as if it were performed in a sufficiently-large signed integral type. This implies that the result is always rounded towards negative infinity and that no overflow will ever occur.Examples
# use NonZero; # # #const fn is_power_of_two(self: Self) -> boolReturns
trueif and only ifself == (1 << k)for somek.On many architectures, this function can perform better than
is_power_of_two()on the underlying integer type, as special handling of zero can be avoided.Examples
# use NonZero; # # #const fn isqrt(self: Self) -> SelfReturns the square root of the number, rounded down.
Examples
# use NonZero; # # #const fn cast_signed(self: Self) -> NonZero<isize>Returns the bit pattern of
selfreinterpreted as a signed integer of the same size.Examples
# use NonZero; let n = MAX; assert_eq!;const fn bit_width(self: Self) -> NonZero<u32>Returns the minimum number of bits required to represent
self.Examples
# use NonZero; # # #const fn checked_mul(self: Self, other: Self) -> Option<Self>Multiplies two non-zero integers together. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together. Return [
NonZero::<usize>::MAX] on overflow.Examples
# use NonZero; # # #unsafe const fn unchecked_mul(self: Self, other: Self) -> SelfMultiplies two non-zero integers together, assuming overflow cannot occur. Overflow is unchecked, and it is undefined behavior to overflow even if the result would wrap to a non-zero value. The behavior is undefined as soon as
self * rhs > usize::MAX.Examples
# use NonZero; # # #const fn checked_pow(self: Self, other: u32) -> Option<Self>Raises non-zero value to an integer power. Checks for overflow and returns
Noneon overflow. As a consequence, the result cannot wrap to zero.Examples
# use NonZero; # # #const fn saturating_pow(self: Self, other: u32) -> SelfRaise non-zero value to an integer power. Return [
NonZero::<usize>::MAX] on overflow.Examples
# use NonZero; # # #const fn from_ascii(src: &[u8]) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with decimal digits.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from an ASCII-byte slice with digits in a given base.
The characters are expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>Parses a non-zero integer from a string slice with digits in a given base.
The string is expected to be an optional
+sign followed by only digits. Leading and trailing non-digit characters (including whitespace) represent an error. Underscores (which are accepted in Rust literals) also represent an error.Digits are a subset of these characters, depending on
radix:0-9a-zA-Z
Panics
This method panics if
radixis not in the range from 2 to 36.Examples
# use NonZero; # # #Trailing space returns error:
# use NonZero; # assert!;
impl NonZero<usize>
const fn div_ceil(self: Self, rhs: Self) -> SelfCalculates the quotient of
selfandrhs, rounding the result towards positive infinity.The result is guaranteed to be non-zero.
Examples
# use NonZero; let one = new.unwrap; let max = new.unwrap; assert_eq!; let two = new.unwrap; let three = new.unwrap; assert_eq!;
impl<T> NonZero<T>
const fn new(n: T) -> Option<Self>Creates a non-zero if the given value is not zero.
unsafe const fn new_unchecked(n: T) -> SelfCreates a non-zero without checking whether the value is non-zero. This results in undefined behavior if the value is zero.
Safety
The value must not be zero.
fn from_mut(n: &mut T) -> Option<&mut Self>Converts a reference to a non-zero mutable reference if the referenced value is not zero.
unsafe fn from_mut_unchecked(n: &mut T) -> &mut SelfConverts a mutable reference to a non-zero mutable reference without checking whether the referenced value is non-zero. This results in undefined behavior if the referenced value is zero.
Safety
The referenced value must not be zero.
const fn get(self: Self) -> TReturns the contained value as a primitive type.
impl From for NonZero<i128>
fn from(small: NonZero<u32>) -> SelfConverts
[NonZero]<[u32]>to[NonZero]<[i128]>losslessly.
impl From for NonZero<i128>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[i128]>losslessly.
impl From for NonZero<i128>
fn from(small: NonZero<u64>) -> SelfConverts
[NonZero]<[u64]>to[NonZero]<[i128]>losslessly.
impl From for NonZero<i128>
fn from(small: NonZero<i8>) -> SelfConverts
[NonZero]<[i8]>to[NonZero]<[i128]>losslessly.
impl From for NonZero<i128>
fn from(small: NonZero<i32>) -> SelfConverts
[NonZero]<[i32]>to[NonZero]<[i128]>losslessly.
impl From for NonZero<i128>
fn from(small: NonZero<i64>) -> SelfConverts
[NonZero]<[i64]>to[NonZero]<[i128]>losslessly.
impl From for NonZero<i128>
fn from(small: NonZero<u16>) -> SelfConverts
[NonZero]<[u16]>to[NonZero]<[i128]>losslessly.
impl From for NonZero<i128>
fn from(small: NonZero<i16>) -> SelfConverts
[NonZero]<[i16]>to[NonZero]<[i128]>losslessly.
impl From for NonZero<i16>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[i16]>losslessly.
impl From for NonZero<i16>
fn from(small: NonZero<i8>) -> SelfConverts
[NonZero]<[i8]>to[NonZero]<[i16]>losslessly.
impl From for NonZero<i32>
fn from(small: NonZero<u16>) -> SelfConverts
[NonZero]<[u16]>to[NonZero]<[i32]>losslessly.
impl From for NonZero<i32>
fn from(small: NonZero<i16>) -> SelfConverts
[NonZero]<[i16]>to[NonZero]<[i32]>losslessly.
impl From for NonZero<i32>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[i32]>losslessly.
impl From for NonZero<i32>
fn from(small: NonZero<i8>) -> SelfConverts
[NonZero]<[i8]>to[NonZero]<[i32]>losslessly.
impl From for NonZero<i64>
fn from(small: NonZero<i8>) -> SelfConverts
[NonZero]<[i8]>to[NonZero]<[i64]>losslessly.
impl From for NonZero<i64>
fn from(small: NonZero<i32>) -> SelfConverts
[NonZero]<[i32]>to[NonZero]<[i64]>losslessly.
impl From for NonZero<i64>
fn from(small: NonZero<u16>) -> SelfConverts
[NonZero]<[u16]>to[NonZero]<[i64]>losslessly.
impl From for NonZero<i64>
fn from(small: NonZero<i16>) -> SelfConverts
[NonZero]<[i16]>to[NonZero]<[i64]>losslessly.
impl From for NonZero<i64>
fn from(small: NonZero<u32>) -> SelfConverts
[NonZero]<[u32]>to[NonZero]<[i64]>losslessly.
impl From for NonZero<i64>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[i64]>losslessly.
impl From for NonZero<isize>
fn from(small: NonZero<i16>) -> SelfConverts
[NonZero]<[i16]>to[NonZero]<[isize]>losslessly.
impl From for NonZero<isize>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[isize]>losslessly.
impl From for NonZero<isize>
fn from(small: NonZero<i8>) -> SelfConverts
[NonZero]<[i8]>to[NonZero]<[isize]>losslessly.
impl From for NonZero<u128>
fn from(small: NonZero<u16>) -> SelfConverts
[NonZero]<[u16]>to[NonZero]<[u128]>losslessly.
impl From for NonZero<u128>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[u128]>losslessly.
impl From for NonZero<u128>
fn from(small: NonZero<u32>) -> SelfConverts
[NonZero]<[u32]>to[NonZero]<[u128]>losslessly.
impl From for NonZero<u128>
fn from(small: NonZero<u64>) -> SelfConverts
[NonZero]<[u64]>to[NonZero]<[u128]>losslessly.
impl From for NonZero<u16>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[u16]>losslessly.
impl From for NonZero<u32>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[u32]>losslessly.
impl From for NonZero<u32>
fn from(small: NonZero<u16>) -> SelfConverts
[NonZero]<[u16]>to[NonZero]<[u32]>losslessly.
impl From for NonZero<u64>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[u64]>losslessly.
impl From for NonZero<u64>
fn from(small: NonZero<u32>) -> SelfConverts
[NonZero]<[u32]>to[NonZero]<[u64]>losslessly.
impl From for NonZero<u64>
fn from(small: NonZero<u16>) -> SelfConverts
[NonZero]<[u16]>to[NonZero]<[u64]>losslessly.
impl From for NonZero<usize>
fn from(small: NonZero<u16>) -> SelfConverts
[NonZero]<[u16]>to[NonZero]<[usize]>losslessly.
impl From for NonZero<usize>
fn from(small: NonZero<u8>) -> SelfConverts
[NonZero]<[u8]>to[NonZero]<[usize]>losslessly.
impl From for NonZero<usize>
fn from(align: Alignment) -> NonZero<usize>
impl FromStr for NonZero<i128>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<i16>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<i32>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<i64>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<i8>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<isize>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<u128>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<u16>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<u32>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<u64>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<u8>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl FromStr for NonZero<usize>
fn from_str(src: &str) -> Result<Self, <Self as >::Err>
impl Neg for NonZero<i128>
fn neg(self: Self) -> Self
impl Neg for NonZero<i16>
fn neg(self: Self) -> Self
impl Neg for NonZero<i32>
fn neg(self: Self) -> Self
impl Neg for NonZero<i64>
fn neg(self: Self) -> Self
impl Neg for NonZero<i8>
fn neg(self: Self) -> Self
impl Neg for NonZero<isize>
fn neg(self: Self) -> Self
impl TryFrom for NonZero<i128>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[i128]>.
impl TryFrom for NonZero<i128>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[i128]>.
impl TryFrom for NonZero<i128>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[i128]>.
impl TryFrom for NonZero<i128>
fn try_from(value: i128) -> Result<Self, <Self as >::Error>Attempts to convert
i128to[NonZero]<[i128]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<u32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u32]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<u16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u16]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[i16]>.
impl TryFrom for NonZero<i16>
fn try_from(value: i16) -> Result<Self, <Self as >::Error>Attempts to convert
i16to[NonZero]<[i16]>.
impl TryFrom for NonZero<i32>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[i32]>.
impl TryFrom for NonZero<i32>
fn try_from(value: i32) -> Result<Self, <Self as >::Error>Attempts to convert
i32to[NonZero]<[i32]>.
impl TryFrom for NonZero<i32>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[i32]>.
impl TryFrom for NonZero<i32>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[i32]>.
impl TryFrom for NonZero<i32>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[i32]>.
impl TryFrom for NonZero<i32>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[i32]>.
impl TryFrom for NonZero<i32>
fn try_from(value: NonZero<u32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u32]>to[NonZero]<[i32]>.
impl TryFrom for NonZero<i32>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[i32]>.
impl TryFrom for NonZero<i64>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[i64]>.
impl TryFrom for NonZero<i64>
fn try_from(value: i64) -> Result<Self, <Self as >::Error>Attempts to convert
i64to[NonZero]<[i64]>.
impl TryFrom for NonZero<i64>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[i64]>.
impl TryFrom for NonZero<i64>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[i64]>.
impl TryFrom for NonZero<i64>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[i64]>.
impl TryFrom for NonZero<i64>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[i64]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<u32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u32]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<i16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i16]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<u8>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u8]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<u16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u16]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[i8]>.
impl TryFrom for NonZero<i8>
fn try_from(value: i8) -> Result<Self, <Self as >::Error>Attempts to convert
i8to[NonZero]<[i8]>.
impl TryFrom for NonZero<isize>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[isize]>.
impl TryFrom for NonZero<isize>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[isize]>.
impl TryFrom for NonZero<isize>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[isize]>.
impl TryFrom for NonZero<isize>
fn try_from(value: NonZero<u32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u32]>to[NonZero]<[isize]>.
impl TryFrom for NonZero<isize>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[isize]>.
impl TryFrom for NonZero<isize>
fn try_from(value: isize) -> Result<Self, <Self as >::Error>Attempts to convert
isizeto[NonZero]<[isize]>.
impl TryFrom for NonZero<isize>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[isize]>.
impl TryFrom for NonZero<isize>
fn try_from(value: NonZero<u16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u16]>to[NonZero]<[isize]>.
impl TryFrom for NonZero<isize>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[isize]>.
impl TryFrom for NonZero<u128>
fn try_from(value: NonZero<i16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i16]>to[NonZero]<[u128]>.
impl TryFrom for NonZero<u128>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[u128]>.
impl TryFrom for NonZero<u128>
fn try_from(value: u128) -> Result<Self, <Self as >::Error>Attempts to convert
u128to[NonZero]<[u128]>.
impl TryFrom for NonZero<u128>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[u128]>.
impl TryFrom for NonZero<u128>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[u128]>.
impl TryFrom for NonZero<u128>
fn try_from(value: NonZero<i8>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i8]>to[NonZero]<[u128]>.
impl TryFrom for NonZero<u128>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[u128]>.
impl TryFrom for NonZero<u128>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[u128]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<i8>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i8]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<i16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i16]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<u32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u32]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: u16) -> Result<Self, <Self as >::Error>Attempts to convert
u16to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u16>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[u16]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<i8>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i8]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<i16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i16]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[u32]>.
impl TryFrom for NonZero<u32>
fn try_from(value: u32) -> Result<Self, <Self as >::Error>Attempts to convert
u32to[NonZero]<[u32]>.
impl TryFrom for NonZero<u64>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[u64]>.
impl TryFrom for NonZero<u64>
fn try_from(value: u64) -> Result<Self, <Self as >::Error>Attempts to convert
u64to[NonZero]<[u64]>.
impl TryFrom for NonZero<u64>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[u64]>.
impl TryFrom for NonZero<u64>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[u64]>.
impl TryFrom for NonZero<u64>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[u64]>.
impl TryFrom for NonZero<u64>
fn try_from(value: NonZero<i8>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i8]>to[NonZero]<[u64]>.
impl TryFrom for NonZero<u64>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[u64]>.
impl TryFrom for NonZero<u64>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[u64]>.
impl TryFrom for NonZero<u64>
fn try_from(value: NonZero<i16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i16]>to[NonZero]<[u64]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<usize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[usize]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<u16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u16]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<i16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i16]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<u32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u32]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: u8) -> Result<Self, <Self as >::Error>Attempts to convert
u8to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<u8>
fn try_from(value: NonZero<i8>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i8]>to[NonZero]<[u8]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<i8>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i8]>to[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<i64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i64]>to[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<i16>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i16]>to[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<i128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i128]>to[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: usize) -> Result<Self, <Self as >::Error>Attempts to convert
usizeto[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<u64>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u64]>to[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<u32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u32]>to[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<i32>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[i32]>to[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<u128>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[u128]>to[NonZero]<[usize]>.
impl TryFrom for NonZero<usize>
fn try_from(value: NonZero<isize>) -> Result<Self, <Self as >::Error>Attempts to convert
[NonZero]<[isize]>to[NonZero]<[usize]>.
impl<T> Any for NonZero<T>
fn type_id(self: &Self) -> TypeId
impl<T> Binary for NonZero<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> BitOr for NonZero<T>
fn bitor(self: Self, rhs: Self) -> <Self as >::Output
impl<T> BitOr for NonZero<T>
fn bitor(self: Self, rhs: T) -> <Self as >::Output
impl<T> BitOrAssign for NonZero<T>
fn bitor_assign(self: &mut Self, rhs: T)
impl<T> BitOrAssign for NonZero<T>
fn bitor_assign(self: &mut Self, rhs: Self)
impl<T> Borrow for NonZero<T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for NonZero<T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> Clone for NonZero<T>
fn clone(self: &Self) -> Self
impl<T> CloneToUninit for NonZero<T>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> Copy for NonZero<T>
impl<T> Debug for NonZero<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Display for NonZero<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Eq for NonZero<T>
impl<T> Freeze for NonZero<T>
impl<T> From for NonZero<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Hash for NonZero<T>
fn hash<H>(self: &Self, state: &mut H) where H: Hasher
impl<T> LowerExp for NonZero<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> LowerHex for NonZero<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Octal for NonZero<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Ord for NonZero<T>
fn cmp(self: &Self, other: &Self) -> Orderingfn max(self: Self, other: Self) -> Selffn min(self: Self, other: Self) -> Selffn clamp(self: Self, min: Self, max: Self) -> Self
impl<T> PartialEq for NonZero<T>
fn eq(self: &Self, other: &Self) -> boolfn ne(self: &Self, other: &Self) -> bool
impl<T> PartialOrd for NonZero<T>
fn partial_cmp(self: &Self, other: &Self) -> Option<Ordering>fn lt(self: &Self, other: &Self) -> boolfn le(self: &Self, other: &Self) -> boolfn gt(self: &Self, other: &Self) -> boolfn ge(self: &Self, other: &Self) -> bool
impl<T> RefUnwindSafe for NonZero<T>
impl<T> Send for NonZero<T>
impl<T> StructuralPartialEq for NonZero<T>
impl<T> Sync for NonZero<T>
impl<T> Unpin for NonZero<T>
impl<T> UnsafeUnpin for NonZero<T>
impl<T> UnwindSafe for NonZero<T>
impl<T> UpperExp for NonZero<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> UpperHex for NonZero<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> UseCloned for NonZero<T>
impl<T, U> Into for NonZero<T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for NonZero<T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for NonZero<T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>