#[repr(transparent)]pub struct NonZero<T>(<T as ZeroablePrimitive>::NonZeroInner)
where
T: ZeroablePrimitive;Expand description
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 core::{num::NonZero};
assert_eq!(size_of::<Option<NonZero<u32>>>(), size_of::<u32>());ยง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 std::num::NonZero;
assert_eq!(size_of::<NonZero<u32>>(), size_of::<Option<NonZero<u32>>>());
assert_eq!(align_of::<NonZero<u32>>(), align_of::<Option<NonZero<u32>>>());ยง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.
Tuple Fieldsยง
ยง0: <T as ZeroablePrimitive>::NonZeroInnerImplementationsยง
Sourceยงimpl<T> NonZero<T>where
T: ZeroablePrimitive,
impl<T> NonZero<T>where
T: ZeroablePrimitive,
1.28.0 (const: 1.47.0) ยท Sourcepub const fn new(n: T) -> Option<NonZero<T>>
pub const fn new(n: T) -> Option<NonZero<T>>
Creates a non-zero if the given value is not zero.
1.28.0 (const: 1.28.0) ยท Sourcepub const unsafe fn new_unchecked(n: T) -> NonZero<T>
pub const unsafe fn new_unchecked(n: T) -> NonZero<T>
Creates 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.
Sourcepub fn from_mut(n: &mut T) -> Option<&mut NonZero<T>>
๐ฌThis is a nightly-only experimental API. (nonzero_from_mut)
pub fn from_mut(n: &mut T) -> Option<&mut NonZero<T>>
nonzero_from_mut)Converts a reference to a non-zero mutable reference if the referenced value is not zero.
Sourcepub unsafe fn from_mut_unchecked(n: &mut T) -> &mut NonZero<T>
๐ฌThis is a nightly-only experimental API. (nonzero_from_mut)
pub unsafe fn from_mut_unchecked(n: &mut T) -> &mut NonZero<T>
nonzero_from_mut)Converts 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.
Sourceยงimpl NonZero<u8>
impl NonZero<u8>
1.70.0 ยท Sourcepub const MIN: NonZero<u8>
pub const MIN: NonZero<u8>
The smallest value that can be represented by this non-zero integer type, 1.
ยงExamples
assert_eq!(NonZero::<u8>::MIN.get(), 1u8);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<u8>::new(u8::MAX)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<u8>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<u8>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u8>::new(0b_01100100)?;
let b = NonZero::<u8>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<u8>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u8>::new(0b_01100100)?;
let b = NonZero::<u8>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u8>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<u8>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<u8>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u8>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<u8>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<u8>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<u8>::new(0b100_0000)?;
let b = NonZero::<u8>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<u8>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x82u8)?;
let m = NonZero::new(0xa)?;
assert_eq!(n.rotate_left(2), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<u8>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xau8)?;
let m = NonZero::new(0x82)?;
assert_eq!(n.rotate_right(2), m);Sourcepub const fn swap_bytes(self) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<u8>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12u8)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x12)?);Sourcepub const fn reverse_bits(self) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<u8>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12u8)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x48)?);Sourcepub const fn from_be(x: NonZero<u8>) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<u8>) -> NonZero<u8>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU8;
let n = NonZero::new(0x1Au8)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroU8::from_be(n), n)
} else {
assert_eq!(NonZeroU8::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<u8>) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<u8>) -> NonZero<u8>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU8;
let n = NonZero::new(0x1Au8)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroU8::from_le(n), n)
} else {
assert_eq!(NonZeroU8::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<u8>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au8)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<u8>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au8)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_add(self, other: u8) -> Option<NonZero<u8>>
pub const fn checked_add(self, other: u8) -> Option<NonZero<u8>>
Adds an unsigned integer to a non-zero value.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let one = NonZero::new(1u8)?;
let two = NonZero::new(2u8)?;
let max = NonZero::new(u8::MAX)?;
assert_eq!(Some(two), one.checked_add(1));
assert_eq!(None, max.checked_add(1));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_add(self, other: u8) -> NonZero<u8>
pub const fn saturating_add(self, other: u8) -> NonZero<u8>
Adds an unsigned integer to a non-zero value.
Return NonZero::<u8>::MAX on overflow.
ยงExamples
let one = NonZero::new(1u8)?;
let two = NonZero::new(2u8)?;
let max = NonZero::new(u8::MAX)?;
assert_eq!(two, one.saturating_add(1));
assert_eq!(max, max.saturating_add(1));Sourcepub const unsafe fn unchecked_add(self, other: u8) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_add(self, other: u8) -> NonZero<u8>
nonzero_ops)Adds 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
#![feature(nonzero_ops)]
let one = NonZero::new(1u8)?;
let two = NonZero::new(2u8)?;
assert_eq!(two, unsafe { one.unchecked_add(1) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_next_power_of_two(self) -> Option<NonZero<u8>>
pub const fn checked_next_power_of_two(self) -> Option<NonZero<u8>>
Returns the smallest power of two greater than or equal to self.
Checks for overflow and returns None
if the next power of two is greater than the typeโs maximum value.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u8)?;
let three = NonZero::new(3u8)?;
let four = NonZero::new(4u8)?;
let max = NonZero::new(u8::MAX)?;
assert_eq!(Some(two), two.checked_next_power_of_two() );
assert_eq!(Some(four), three.checked_next_power_of_two() );
assert_eq!(None, max.checked_next_power_of_two() );1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog2(self) -> u32
pub const fn ilog2(self) -> u32
Returns 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
assert_eq!(NonZero::new(7u8)?.ilog2(), 2);
assert_eq!(NonZero::new(8u8)?.ilog2(), 3);
assert_eq!(NonZero::new(9u8)?.ilog2(), 3);1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog10(self) -> u32
pub const fn ilog10(self) -> u32
Returns 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
assert_eq!(NonZero::new(99u8)?.ilog10(), 1);
assert_eq!(NonZero::new(100u8)?.ilog10(), 2);
assert_eq!(NonZero::new(101u8)?.ilog10(), 2);1.85.0 (const: 1.85.0) ยท Sourcepub const fn midpoint(self, rhs: NonZero<u8>) -> NonZero<u8>
pub const fn midpoint(self, rhs: NonZero<u8>) -> NonZero<u8>
Calculates the midpoint (average) between self and rhs.
midpoint(a, b) is (a + b) >> 1 as 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
let one = NonZero::new(1u8)?;
let two = NonZero::new(2u8)?;
let four = NonZero::new(4u8)?;
assert_eq!(one.midpoint(four), two);
assert_eq!(four.midpoint(one), two);1.59.0 (const: 1.59.0) ยท Sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == (1 << k) for some k.
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
let eight = NonZero::new(8u8)?;
assert!(eight.is_power_of_two());
let ten = NonZero::new(10u8)?;
assert!(!ten.is_power_of_two());1.84.0 (const: 1.84.0) ยท Sourcepub const fn isqrt(self) -> NonZero<u8>
pub const fn isqrt(self) -> NonZero<u8>
Returns the square root of the number, rounded down.
ยงExamples
let ten = NonZero::new(10u8)?;
let three = NonZero::new(3u8)?;
assert_eq!(ten.isqrt(), three);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_signed(self) -> NonZero<i8>
pub const fn cast_signed(self) -> NonZero<i8>
Returns the bit pattern of self reinterpreted as a signed integer of the same size.
ยงExamples
let n = NonZero::<u8>::MAX;
assert_eq!(n.cast_signed(), NonZero::new(-1i8).unwrap());Sourcepub const fn bit_width(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (uint_bit_width)
pub const fn bit_width(self) -> NonZero<u32>
uint_bit_width)Returns the minimum number of bits required to represent self.
ยงExamples
#![feature(uint_bit_width)]
assert_eq!(NonZero::<u8>::MIN.bit_width(), NonZero::new(1)?);
assert_eq!(NonZero::<u8>::new(0b111)?.bit_width(), NonZero::new(3)?);
assert_eq!(NonZero::<u8>::new(0b1110)?.bit_width(), NonZero::new(4)?);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<u8>) -> Option<NonZero<u8>>
pub const fn checked_mul(self, other: NonZero<u8>) -> Option<NonZero<u8>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u8)?;
let four = NonZero::new(4u8)?;
let max = NonZero::new(u8::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<u8>) -> NonZero<u8>
pub const fn saturating_mul(self, other: NonZero<u8>) -> NonZero<u8>
Multiplies two non-zero integers together.
Return NonZero::<u8>::MAX on overflow.
ยงExamples
let two = NonZero::new(2u8)?;
let four = NonZero::new(4u8)?;
let max = NonZero::new(u8::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<u8>) -> NonZero<u8>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<u8>) -> NonZero<u8>
nonzero_ops)Multiplies 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
#![feature(nonzero_ops)]
let two = NonZero::new(2u8)?;
let four = NonZero::new(4u8)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<u8>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<u8>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3u8)?;
let twenty_seven = NonZero::new(27u8)?;
let half_max = NonZero::new(u8::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<u8>
pub const fn saturating_pow(self, other: u32) -> NonZero<u8>
Raise non-zero value to an integer power.
Return NonZero::<u8>::MAX on overflow.
ยงExamples
let three = NonZero::new(3u8)?;
let twenty_seven = NonZero::new(27u8)?;
let max = NonZero::new(u8::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<u8>
impl NonZero<u8>
1.92.0 (const: 1.92.0) ยท Sourcepub const fn div_ceil(self, rhs: NonZero<u8>) -> NonZero<u8>
pub const fn div_ceil(self, rhs: NonZero<u8>) -> NonZero<u8>
Calculates the quotient of self and rhs, rounding the result towards positive infinity.
The result is guaranteed to be non-zero.
ยงExamples
let one = NonZero::new(1u8).unwrap();
let max = NonZero::new(u8::MAX).unwrap();
assert_eq!(one.div_ceil(max), one);
let two = NonZero::new(2u8).unwrap();
let three = NonZero::new(3u8).unwrap();
assert_eq!(three.div_ceil(two), two);Sourceยงimpl NonZero<u16>
impl NonZero<u16>
1.70.0 ยท Sourcepub const MIN: NonZero<u16>
pub const MIN: NonZero<u16>
The smallest value that can be represented by this non-zero integer type, 1.
ยงExamples
assert_eq!(NonZero::<u16>::MIN.get(), 1u16);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<u16>::new(u16::MAX)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<u16>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<u16>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u16>::new(0b_01100100)?;
let b = NonZero::<u16>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<u16>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u16>::new(0b_01100100)?;
let b = NonZero::<u16>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u16>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<u16>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<u16>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u16>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<u16>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<u16>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<u16>::new(0b100_0000)?;
let b = NonZero::<u16>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<u16>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xa003u16)?;
let m = NonZero::new(0x3a)?;
assert_eq!(n.rotate_left(4), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<u16>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x3au16)?;
let m = NonZero::new(0xa003)?;
assert_eq!(n.rotate_right(4), m);Sourcepub const fn swap_bytes(self) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<u16>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234u16)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x3412)?);Sourcepub const fn reverse_bits(self) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<u16>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234u16)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x2c48)?);Sourcepub const fn from_be(x: NonZero<u16>) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<u16>) -> NonZero<u16>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU16;
let n = NonZero::new(0x1Au16)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroU16::from_be(n), n)
} else {
assert_eq!(NonZeroU16::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<u16>) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<u16>) -> NonZero<u16>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU16;
let n = NonZero::new(0x1Au16)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroU16::from_le(n), n)
} else {
assert_eq!(NonZeroU16::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<u16>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au16)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<u16>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au16)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_add(self, other: u16) -> Option<NonZero<u16>>
pub const fn checked_add(self, other: u16) -> Option<NonZero<u16>>
Adds an unsigned integer to a non-zero value.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let one = NonZero::new(1u16)?;
let two = NonZero::new(2u16)?;
let max = NonZero::new(u16::MAX)?;
assert_eq!(Some(two), one.checked_add(1));
assert_eq!(None, max.checked_add(1));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_add(self, other: u16) -> NonZero<u16>
pub const fn saturating_add(self, other: u16) -> NonZero<u16>
Adds an unsigned integer to a non-zero value.
Return NonZero::<u16>::MAX on overflow.
ยงExamples
let one = NonZero::new(1u16)?;
let two = NonZero::new(2u16)?;
let max = NonZero::new(u16::MAX)?;
assert_eq!(two, one.saturating_add(1));
assert_eq!(max, max.saturating_add(1));Sourcepub const unsafe fn unchecked_add(self, other: u16) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_add(self, other: u16) -> NonZero<u16>
nonzero_ops)Adds 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
#![feature(nonzero_ops)]
let one = NonZero::new(1u16)?;
let two = NonZero::new(2u16)?;
assert_eq!(two, unsafe { one.unchecked_add(1) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_next_power_of_two(self) -> Option<NonZero<u16>>
pub const fn checked_next_power_of_two(self) -> Option<NonZero<u16>>
Returns the smallest power of two greater than or equal to self.
Checks for overflow and returns None
if the next power of two is greater than the typeโs maximum value.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u16)?;
let three = NonZero::new(3u16)?;
let four = NonZero::new(4u16)?;
let max = NonZero::new(u16::MAX)?;
assert_eq!(Some(two), two.checked_next_power_of_two() );
assert_eq!(Some(four), three.checked_next_power_of_two() );
assert_eq!(None, max.checked_next_power_of_two() );1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog2(self) -> u32
pub const fn ilog2(self) -> u32
Returns 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
assert_eq!(NonZero::new(7u16)?.ilog2(), 2);
assert_eq!(NonZero::new(8u16)?.ilog2(), 3);
assert_eq!(NonZero::new(9u16)?.ilog2(), 3);1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog10(self) -> u32
pub const fn ilog10(self) -> u32
Returns 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
assert_eq!(NonZero::new(99u16)?.ilog10(), 1);
assert_eq!(NonZero::new(100u16)?.ilog10(), 2);
assert_eq!(NonZero::new(101u16)?.ilog10(), 2);1.85.0 (const: 1.85.0) ยท Sourcepub const fn midpoint(self, rhs: NonZero<u16>) -> NonZero<u16>
pub const fn midpoint(self, rhs: NonZero<u16>) -> NonZero<u16>
Calculates the midpoint (average) between self and rhs.
midpoint(a, b) is (a + b) >> 1 as 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
let one = NonZero::new(1u16)?;
let two = NonZero::new(2u16)?;
let four = NonZero::new(4u16)?;
assert_eq!(one.midpoint(four), two);
assert_eq!(four.midpoint(one), two);1.59.0 (const: 1.59.0) ยท Sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == (1 << k) for some k.
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
let eight = NonZero::new(8u16)?;
assert!(eight.is_power_of_two());
let ten = NonZero::new(10u16)?;
assert!(!ten.is_power_of_two());1.84.0 (const: 1.84.0) ยท Sourcepub const fn isqrt(self) -> NonZero<u16>
pub const fn isqrt(self) -> NonZero<u16>
Returns the square root of the number, rounded down.
ยงExamples
let ten = NonZero::new(10u16)?;
let three = NonZero::new(3u16)?;
assert_eq!(ten.isqrt(), three);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_signed(self) -> NonZero<i16>
pub const fn cast_signed(self) -> NonZero<i16>
Returns the bit pattern of self reinterpreted as a signed integer of the same size.
ยงExamples
let n = NonZero::<u16>::MAX;
assert_eq!(n.cast_signed(), NonZero::new(-1i16).unwrap());Sourcepub const fn bit_width(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (uint_bit_width)
pub const fn bit_width(self) -> NonZero<u32>
uint_bit_width)Returns the minimum number of bits required to represent self.
ยงExamples
#![feature(uint_bit_width)]
assert_eq!(NonZero::<u16>::MIN.bit_width(), NonZero::new(1)?);
assert_eq!(NonZero::<u16>::new(0b111)?.bit_width(), NonZero::new(3)?);
assert_eq!(NonZero::<u16>::new(0b1110)?.bit_width(), NonZero::new(4)?);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<u16>) -> Option<NonZero<u16>>
pub const fn checked_mul(self, other: NonZero<u16>) -> Option<NonZero<u16>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u16)?;
let four = NonZero::new(4u16)?;
let max = NonZero::new(u16::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<u16>) -> NonZero<u16>
pub const fn saturating_mul(self, other: NonZero<u16>) -> NonZero<u16>
Multiplies two non-zero integers together.
Return NonZero::<u16>::MAX on overflow.
ยงExamples
let two = NonZero::new(2u16)?;
let four = NonZero::new(4u16)?;
let max = NonZero::new(u16::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<u16>) -> NonZero<u16>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<u16>) -> NonZero<u16>
nonzero_ops)Multiplies 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
#![feature(nonzero_ops)]
let two = NonZero::new(2u16)?;
let four = NonZero::new(4u16)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<u16>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<u16>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3u16)?;
let twenty_seven = NonZero::new(27u16)?;
let half_max = NonZero::new(u16::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<u16>
pub const fn saturating_pow(self, other: u32) -> NonZero<u16>
Raise non-zero value to an integer power.
Return NonZero::<u16>::MAX on overflow.
ยงExamples
let three = NonZero::new(3u16)?;
let twenty_seven = NonZero::new(27u16)?;
let max = NonZero::new(u16::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<u16>
impl NonZero<u16>
1.92.0 (const: 1.92.0) ยท Sourcepub const fn div_ceil(self, rhs: NonZero<u16>) -> NonZero<u16>
pub const fn div_ceil(self, rhs: NonZero<u16>) -> NonZero<u16>
Calculates the quotient of self and rhs, rounding the result towards positive infinity.
The result is guaranteed to be non-zero.
ยงExamples
let one = NonZero::new(1u16).unwrap();
let max = NonZero::new(u16::MAX).unwrap();
assert_eq!(one.div_ceil(max), one);
let two = NonZero::new(2u16).unwrap();
let three = NonZero::new(3u16).unwrap();
assert_eq!(three.div_ceil(two), two);Sourceยงimpl NonZero<u32>
impl NonZero<u32>
1.70.0 ยท Sourcepub const MIN: NonZero<u32>
pub const MIN: NonZero<u32>
The smallest value that can be represented by this non-zero integer type, 1.
ยงExamples
assert_eq!(NonZero::<u32>::MIN.get(), 1u32);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<u32>::new(u32::MAX)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<u32>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<u32>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u32>::new(0b_01100100)?;
let b = NonZero::<u32>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<u32>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u32>::new(0b_01100100)?;
let b = NonZero::<u32>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u32>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<u32>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<u32>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u32>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<u32>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<u32>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<u32>::new(0b100_0000)?;
let b = NonZero::<u32>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<u32>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x10000b3u32)?;
let m = NonZero::new(0xb301)?;
assert_eq!(n.rotate_left(8), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<u32>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xb301u32)?;
let m = NonZero::new(0x10000b3)?;
assert_eq!(n.rotate_right(8), m);Sourcepub const fn swap_bytes(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<u32>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12345678u32)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x78563412)?);Sourcepub const fn reverse_bits(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<u32>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12345678u32)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x1e6a2c48)?);Sourcepub const fn from_be(x: NonZero<u32>) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<u32>) -> NonZero<u32>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU32;
let n = NonZero::new(0x1Au32)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroU32::from_be(n), n)
} else {
assert_eq!(NonZeroU32::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<u32>) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<u32>) -> NonZero<u32>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU32;
let n = NonZero::new(0x1Au32)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroU32::from_le(n), n)
} else {
assert_eq!(NonZeroU32::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<u32>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au32)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<u32>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au32)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_add(self, other: u32) -> Option<NonZero<u32>>
pub const fn checked_add(self, other: u32) -> Option<NonZero<u32>>
Adds an unsigned integer to a non-zero value.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let one = NonZero::new(1u32)?;
let two = NonZero::new(2u32)?;
let max = NonZero::new(u32::MAX)?;
assert_eq!(Some(two), one.checked_add(1));
assert_eq!(None, max.checked_add(1));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_add(self, other: u32) -> NonZero<u32>
pub const fn saturating_add(self, other: u32) -> NonZero<u32>
Adds an unsigned integer to a non-zero value.
Return NonZero::<u32>::MAX on overflow.
ยงExamples
let one = NonZero::new(1u32)?;
let two = NonZero::new(2u32)?;
let max = NonZero::new(u32::MAX)?;
assert_eq!(two, one.saturating_add(1));
assert_eq!(max, max.saturating_add(1));Sourcepub const unsafe fn unchecked_add(self, other: u32) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_add(self, other: u32) -> NonZero<u32>
nonzero_ops)Adds 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
#![feature(nonzero_ops)]
let one = NonZero::new(1u32)?;
let two = NonZero::new(2u32)?;
assert_eq!(two, unsafe { one.unchecked_add(1) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_next_power_of_two(self) -> Option<NonZero<u32>>
pub const fn checked_next_power_of_two(self) -> Option<NonZero<u32>>
Returns the smallest power of two greater than or equal to self.
Checks for overflow and returns None
if the next power of two is greater than the typeโs maximum value.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u32)?;
let three = NonZero::new(3u32)?;
let four = NonZero::new(4u32)?;
let max = NonZero::new(u32::MAX)?;
assert_eq!(Some(two), two.checked_next_power_of_two() );
assert_eq!(Some(four), three.checked_next_power_of_two() );
assert_eq!(None, max.checked_next_power_of_two() );1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog2(self) -> u32
pub const fn ilog2(self) -> u32
Returns 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
assert_eq!(NonZero::new(7u32)?.ilog2(), 2);
assert_eq!(NonZero::new(8u32)?.ilog2(), 3);
assert_eq!(NonZero::new(9u32)?.ilog2(), 3);1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog10(self) -> u32
pub const fn ilog10(self) -> u32
Returns 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
assert_eq!(NonZero::new(99u32)?.ilog10(), 1);
assert_eq!(NonZero::new(100u32)?.ilog10(), 2);
assert_eq!(NonZero::new(101u32)?.ilog10(), 2);1.85.0 (const: 1.85.0) ยท Sourcepub const fn midpoint(self, rhs: NonZero<u32>) -> NonZero<u32>
pub const fn midpoint(self, rhs: NonZero<u32>) -> NonZero<u32>
Calculates the midpoint (average) between self and rhs.
midpoint(a, b) is (a + b) >> 1 as 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
let one = NonZero::new(1u32)?;
let two = NonZero::new(2u32)?;
let four = NonZero::new(4u32)?;
assert_eq!(one.midpoint(four), two);
assert_eq!(four.midpoint(one), two);1.59.0 (const: 1.59.0) ยท Sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == (1 << k) for some k.
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
let eight = NonZero::new(8u32)?;
assert!(eight.is_power_of_two());
let ten = NonZero::new(10u32)?;
assert!(!ten.is_power_of_two());1.84.0 (const: 1.84.0) ยท Sourcepub const fn isqrt(self) -> NonZero<u32>
pub const fn isqrt(self) -> NonZero<u32>
Returns the square root of the number, rounded down.
ยงExamples
let ten = NonZero::new(10u32)?;
let three = NonZero::new(3u32)?;
assert_eq!(ten.isqrt(), three);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_signed(self) -> NonZero<i32>
pub const fn cast_signed(self) -> NonZero<i32>
Returns the bit pattern of self reinterpreted as a signed integer of the same size.
ยงExamples
let n = NonZero::<u32>::MAX;
assert_eq!(n.cast_signed(), NonZero::new(-1i32).unwrap());Sourcepub const fn bit_width(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (uint_bit_width)
pub const fn bit_width(self) -> NonZero<u32>
uint_bit_width)Returns the minimum number of bits required to represent self.
ยงExamples
#![feature(uint_bit_width)]
assert_eq!(NonZero::<u32>::MIN.bit_width(), NonZero::new(1)?);
assert_eq!(NonZero::<u32>::new(0b111)?.bit_width(), NonZero::new(3)?);
assert_eq!(NonZero::<u32>::new(0b1110)?.bit_width(), NonZero::new(4)?);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<u32>) -> Option<NonZero<u32>>
pub const fn checked_mul(self, other: NonZero<u32>) -> Option<NonZero<u32>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u32)?;
let four = NonZero::new(4u32)?;
let max = NonZero::new(u32::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<u32>) -> NonZero<u32>
pub const fn saturating_mul(self, other: NonZero<u32>) -> NonZero<u32>
Multiplies two non-zero integers together.
Return NonZero::<u32>::MAX on overflow.
ยงExamples
let two = NonZero::new(2u32)?;
let four = NonZero::new(4u32)?;
let max = NonZero::new(u32::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<u32>) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<u32>) -> NonZero<u32>
nonzero_ops)Multiplies 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
#![feature(nonzero_ops)]
let two = NonZero::new(2u32)?;
let four = NonZero::new(4u32)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<u32>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<u32>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3u32)?;
let twenty_seven = NonZero::new(27u32)?;
let half_max = NonZero::new(u32::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<u32>
pub const fn saturating_pow(self, other: u32) -> NonZero<u32>
Raise non-zero value to an integer power.
Return NonZero::<u32>::MAX on overflow.
ยงExamples
let three = NonZero::new(3u32)?;
let twenty_seven = NonZero::new(27u32)?;
let max = NonZero::new(u32::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<u32>
impl NonZero<u32>
1.92.0 (const: 1.92.0) ยท Sourcepub const fn div_ceil(self, rhs: NonZero<u32>) -> NonZero<u32>
pub const fn div_ceil(self, rhs: NonZero<u32>) -> NonZero<u32>
Calculates the quotient of self and rhs, rounding the result towards positive infinity.
The result is guaranteed to be non-zero.
ยงExamples
let one = NonZero::new(1u32).unwrap();
let max = NonZero::new(u32::MAX).unwrap();
assert_eq!(one.div_ceil(max), one);
let two = NonZero::new(2u32).unwrap();
let three = NonZero::new(3u32).unwrap();
assert_eq!(three.div_ceil(two), two);Sourceยงimpl NonZero<u64>
impl NonZero<u64>
1.70.0 ยท Sourcepub const MIN: NonZero<u64>
pub const MIN: NonZero<u64>
The smallest value that can be represented by this non-zero integer type, 1.
ยงExamples
assert_eq!(NonZero::<u64>::MIN.get(), 1u64);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<u64>::new(u64::MAX)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<u64>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<u64>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u64>::new(0b_01100100)?;
let b = NonZero::<u64>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<u64>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u64>::new(0b_01100100)?;
let b = NonZero::<u64>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u64>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<u64>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<u64>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u64>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<u64>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<u64>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<u64>::new(0b100_0000)?;
let b = NonZero::<u64>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<u64>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xaa00000000006e1u64)?;
let m = NonZero::new(0x6e10aa)?;
assert_eq!(n.rotate_left(12), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<u64>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x6e10aau64)?;
let m = NonZero::new(0xaa00000000006e1)?;
assert_eq!(n.rotate_right(12), m);Sourcepub const fn swap_bytes(self) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<u64>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234567890123456u64)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x5634129078563412)?);Sourcepub const fn reverse_bits(self) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<u64>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234567890123456u64)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x6a2c48091e6a2c48)?);Sourcepub const fn from_be(x: NonZero<u64>) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<u64>) -> NonZero<u64>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU64;
let n = NonZero::new(0x1Au64)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroU64::from_be(n), n)
} else {
assert_eq!(NonZeroU64::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<u64>) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<u64>) -> NonZero<u64>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU64;
let n = NonZero::new(0x1Au64)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroU64::from_le(n), n)
} else {
assert_eq!(NonZeroU64::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<u64>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au64)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<u64>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au64)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_add(self, other: u64) -> Option<NonZero<u64>>
pub const fn checked_add(self, other: u64) -> Option<NonZero<u64>>
Adds an unsigned integer to a non-zero value.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let one = NonZero::new(1u64)?;
let two = NonZero::new(2u64)?;
let max = NonZero::new(u64::MAX)?;
assert_eq!(Some(two), one.checked_add(1));
assert_eq!(None, max.checked_add(1));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_add(self, other: u64) -> NonZero<u64>
pub const fn saturating_add(self, other: u64) -> NonZero<u64>
Adds an unsigned integer to a non-zero value.
Return NonZero::<u64>::MAX on overflow.
ยงExamples
let one = NonZero::new(1u64)?;
let two = NonZero::new(2u64)?;
let max = NonZero::new(u64::MAX)?;
assert_eq!(two, one.saturating_add(1));
assert_eq!(max, max.saturating_add(1));Sourcepub const unsafe fn unchecked_add(self, other: u64) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_add(self, other: u64) -> NonZero<u64>
nonzero_ops)Adds 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
#![feature(nonzero_ops)]
let one = NonZero::new(1u64)?;
let two = NonZero::new(2u64)?;
assert_eq!(two, unsafe { one.unchecked_add(1) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_next_power_of_two(self) -> Option<NonZero<u64>>
pub const fn checked_next_power_of_two(self) -> Option<NonZero<u64>>
Returns the smallest power of two greater than or equal to self.
Checks for overflow and returns None
if the next power of two is greater than the typeโs maximum value.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u64)?;
let three = NonZero::new(3u64)?;
let four = NonZero::new(4u64)?;
let max = NonZero::new(u64::MAX)?;
assert_eq!(Some(two), two.checked_next_power_of_two() );
assert_eq!(Some(four), three.checked_next_power_of_two() );
assert_eq!(None, max.checked_next_power_of_two() );1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog2(self) -> u32
pub const fn ilog2(self) -> u32
Returns 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
assert_eq!(NonZero::new(7u64)?.ilog2(), 2);
assert_eq!(NonZero::new(8u64)?.ilog2(), 3);
assert_eq!(NonZero::new(9u64)?.ilog2(), 3);1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog10(self) -> u32
pub const fn ilog10(self) -> u32
Returns 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
assert_eq!(NonZero::new(99u64)?.ilog10(), 1);
assert_eq!(NonZero::new(100u64)?.ilog10(), 2);
assert_eq!(NonZero::new(101u64)?.ilog10(), 2);1.85.0 (const: 1.85.0) ยท Sourcepub const fn midpoint(self, rhs: NonZero<u64>) -> NonZero<u64>
pub const fn midpoint(self, rhs: NonZero<u64>) -> NonZero<u64>
Calculates the midpoint (average) between self and rhs.
midpoint(a, b) is (a + b) >> 1 as 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
let one = NonZero::new(1u64)?;
let two = NonZero::new(2u64)?;
let four = NonZero::new(4u64)?;
assert_eq!(one.midpoint(four), two);
assert_eq!(four.midpoint(one), two);1.59.0 (const: 1.59.0) ยท Sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == (1 << k) for some k.
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
let eight = NonZero::new(8u64)?;
assert!(eight.is_power_of_two());
let ten = NonZero::new(10u64)?;
assert!(!ten.is_power_of_two());1.84.0 (const: 1.84.0) ยท Sourcepub const fn isqrt(self) -> NonZero<u64>
pub const fn isqrt(self) -> NonZero<u64>
Returns the square root of the number, rounded down.
ยงExamples
let ten = NonZero::new(10u64)?;
let three = NonZero::new(3u64)?;
assert_eq!(ten.isqrt(), three);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_signed(self) -> NonZero<i64>
pub const fn cast_signed(self) -> NonZero<i64>
Returns the bit pattern of self reinterpreted as a signed integer of the same size.
ยงExamples
let n = NonZero::<u64>::MAX;
assert_eq!(n.cast_signed(), NonZero::new(-1i64).unwrap());Sourcepub const fn bit_width(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (uint_bit_width)
pub const fn bit_width(self) -> NonZero<u32>
uint_bit_width)Returns the minimum number of bits required to represent self.
ยงExamples
#![feature(uint_bit_width)]
assert_eq!(NonZero::<u64>::MIN.bit_width(), NonZero::new(1)?);
assert_eq!(NonZero::<u64>::new(0b111)?.bit_width(), NonZero::new(3)?);
assert_eq!(NonZero::<u64>::new(0b1110)?.bit_width(), NonZero::new(4)?);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<u64>) -> Option<NonZero<u64>>
pub const fn checked_mul(self, other: NonZero<u64>) -> Option<NonZero<u64>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u64)?;
let four = NonZero::new(4u64)?;
let max = NonZero::new(u64::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<u64>) -> NonZero<u64>
pub const fn saturating_mul(self, other: NonZero<u64>) -> NonZero<u64>
Multiplies two non-zero integers together.
Return NonZero::<u64>::MAX on overflow.
ยงExamples
let two = NonZero::new(2u64)?;
let four = NonZero::new(4u64)?;
let max = NonZero::new(u64::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<u64>) -> NonZero<u64>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<u64>) -> NonZero<u64>
nonzero_ops)Multiplies 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
#![feature(nonzero_ops)]
let two = NonZero::new(2u64)?;
let four = NonZero::new(4u64)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<u64>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<u64>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3u64)?;
let twenty_seven = NonZero::new(27u64)?;
let half_max = NonZero::new(u64::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<u64>
pub const fn saturating_pow(self, other: u32) -> NonZero<u64>
Raise non-zero value to an integer power.
Return NonZero::<u64>::MAX on overflow.
ยงExamples
let three = NonZero::new(3u64)?;
let twenty_seven = NonZero::new(27u64)?;
let max = NonZero::new(u64::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<u64>
impl NonZero<u64>
1.92.0 (const: 1.92.0) ยท Sourcepub const fn div_ceil(self, rhs: NonZero<u64>) -> NonZero<u64>
pub const fn div_ceil(self, rhs: NonZero<u64>) -> NonZero<u64>
Calculates the quotient of self and rhs, rounding the result towards positive infinity.
The result is guaranteed to be non-zero.
ยงExamples
let one = NonZero::new(1u64).unwrap();
let max = NonZero::new(u64::MAX).unwrap();
assert_eq!(one.div_ceil(max), one);
let two = NonZero::new(2u64).unwrap();
let three = NonZero::new(3u64).unwrap();
assert_eq!(three.div_ceil(two), two);Sourceยงimpl NonZero<u128>
impl NonZero<u128>
1.67.0 ยท Sourcepub const BITS: u32 = 128u32
pub const BITS: u32 = 128u32
The size of this non-zero integer type in bits.
This value is equal to u128::BITS.
ยงExamples
assert_eq!(NonZero::<u128>::BITS, u128::BITS);1.70.0 ยท Sourcepub const MIN: NonZero<u128>
pub const MIN: NonZero<u128>
The smallest value that can be represented by this non-zero integer type, 1.
ยงExamples
assert_eq!(NonZero::<u128>::MIN.get(), 1u128);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<u128>::new(u128::MAX)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<u128>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<u128>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u128>::new(0b_01100100)?;
let b = NonZero::<u128>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<u128>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<u128>::new(0b_01100100)?;
let b = NonZero::<u128>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u128>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<u128>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<u128>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<u128>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<u128>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<u128>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<u128>::new(0b100_0000)?;
let b = NonZero::<u128>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<u128>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x13f40000000000000000000000004f76u128)?;
let m = NonZero::new(0x4f7613f4)?;
assert_eq!(n.rotate_left(16), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<u128>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x4f7613f4u128)?;
let m = NonZero::new(0x13f40000000000000000000000004f76)?;
assert_eq!(n.rotate_right(16), m);Sourcepub const fn swap_bytes(self) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<u128>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12345678901234567890123456789012u128)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x12907856341290785634129078563412)?);Sourcepub const fn reverse_bits(self) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<u128>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12345678901234567890123456789012u128)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x48091e6a2c48091e6a2c48091e6a2c48)?);Sourcepub const fn from_be(x: NonZero<u128>) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<u128>) -> NonZero<u128>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU128;
let n = NonZero::new(0x1Au128)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroU128::from_be(n), n)
} else {
assert_eq!(NonZeroU128::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<u128>) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<u128>) -> NonZero<u128>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroU128;
let n = NonZero::new(0x1Au128)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroU128::from_le(n), n)
} else {
assert_eq!(NonZeroU128::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<u128>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au128)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<u128>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Au128)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_add(self, other: u128) -> Option<NonZero<u128>>
pub const fn checked_add(self, other: u128) -> Option<NonZero<u128>>
Adds an unsigned integer to a non-zero value.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let one = NonZero::new(1u128)?;
let two = NonZero::new(2u128)?;
let max = NonZero::new(u128::MAX)?;
assert_eq!(Some(two), one.checked_add(1));
assert_eq!(None, max.checked_add(1));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_add(self, other: u128) -> NonZero<u128>
pub const fn saturating_add(self, other: u128) -> NonZero<u128>
Adds an unsigned integer to a non-zero value.
Return NonZero::<u128>::MAX on overflow.
ยงExamples
let one = NonZero::new(1u128)?;
let two = NonZero::new(2u128)?;
let max = NonZero::new(u128::MAX)?;
assert_eq!(two, one.saturating_add(1));
assert_eq!(max, max.saturating_add(1));Sourcepub const unsafe fn unchecked_add(self, other: u128) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_add(self, other: u128) -> NonZero<u128>
nonzero_ops)Adds 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
#![feature(nonzero_ops)]
let one = NonZero::new(1u128)?;
let two = NonZero::new(2u128)?;
assert_eq!(two, unsafe { one.unchecked_add(1) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_next_power_of_two(self) -> Option<NonZero<u128>>
pub const fn checked_next_power_of_two(self) -> Option<NonZero<u128>>
Returns the smallest power of two greater than or equal to self.
Checks for overflow and returns None
if the next power of two is greater than the typeโs maximum value.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u128)?;
let three = NonZero::new(3u128)?;
let four = NonZero::new(4u128)?;
let max = NonZero::new(u128::MAX)?;
assert_eq!(Some(two), two.checked_next_power_of_two() );
assert_eq!(Some(four), three.checked_next_power_of_two() );
assert_eq!(None, max.checked_next_power_of_two() );1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog2(self) -> u32
pub const fn ilog2(self) -> u32
Returns 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
assert_eq!(NonZero::new(7u128)?.ilog2(), 2);
assert_eq!(NonZero::new(8u128)?.ilog2(), 3);
assert_eq!(NonZero::new(9u128)?.ilog2(), 3);1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog10(self) -> u32
pub const fn ilog10(self) -> u32
Returns 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
assert_eq!(NonZero::new(99u128)?.ilog10(), 1);
assert_eq!(NonZero::new(100u128)?.ilog10(), 2);
assert_eq!(NonZero::new(101u128)?.ilog10(), 2);1.85.0 (const: 1.85.0) ยท Sourcepub const fn midpoint(self, rhs: NonZero<u128>) -> NonZero<u128>
pub const fn midpoint(self, rhs: NonZero<u128>) -> NonZero<u128>
Calculates the midpoint (average) between self and rhs.
midpoint(a, b) is (a + b) >> 1 as 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
let one = NonZero::new(1u128)?;
let two = NonZero::new(2u128)?;
let four = NonZero::new(4u128)?;
assert_eq!(one.midpoint(four), two);
assert_eq!(four.midpoint(one), two);1.59.0 (const: 1.59.0) ยท Sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == (1 << k) for some k.
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
let eight = NonZero::new(8u128)?;
assert!(eight.is_power_of_two());
let ten = NonZero::new(10u128)?;
assert!(!ten.is_power_of_two());1.84.0 (const: 1.84.0) ยท Sourcepub const fn isqrt(self) -> NonZero<u128>
pub const fn isqrt(self) -> NonZero<u128>
Returns the square root of the number, rounded down.
ยงExamples
let ten = NonZero::new(10u128)?;
let three = NonZero::new(3u128)?;
assert_eq!(ten.isqrt(), three);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_signed(self) -> NonZero<i128>
pub const fn cast_signed(self) -> NonZero<i128>
Returns the bit pattern of self reinterpreted as a signed integer of the same size.
ยงExamples
let n = NonZero::<u128>::MAX;
assert_eq!(n.cast_signed(), NonZero::new(-1i128).unwrap());Sourcepub const fn bit_width(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (uint_bit_width)
pub const fn bit_width(self) -> NonZero<u32>
uint_bit_width)Returns the minimum number of bits required to represent self.
ยงExamples
#![feature(uint_bit_width)]
assert_eq!(NonZero::<u128>::MIN.bit_width(), NonZero::new(1)?);
assert_eq!(NonZero::<u128>::new(0b111)?.bit_width(), NonZero::new(3)?);
assert_eq!(NonZero::<u128>::new(0b1110)?.bit_width(), NonZero::new(4)?);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<u128>) -> Option<NonZero<u128>>
pub const fn checked_mul(self, other: NonZero<u128>) -> Option<NonZero<u128>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2u128)?;
let four = NonZero::new(4u128)?;
let max = NonZero::new(u128::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<u128>) -> NonZero<u128>
pub const fn saturating_mul(self, other: NonZero<u128>) -> NonZero<u128>
Multiplies two non-zero integers together.
Return NonZero::<u128>::MAX on overflow.
ยงExamples
let two = NonZero::new(2u128)?;
let four = NonZero::new(4u128)?;
let max = NonZero::new(u128::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<u128>) -> NonZero<u128>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<u128>) -> NonZero<u128>
nonzero_ops)Multiplies 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
#![feature(nonzero_ops)]
let two = NonZero::new(2u128)?;
let four = NonZero::new(4u128)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<u128>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<u128>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3u128)?;
let twenty_seven = NonZero::new(27u128)?;
let half_max = NonZero::new(u128::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<u128>
pub const fn saturating_pow(self, other: u32) -> NonZero<u128>
Raise non-zero value to an integer power.
Return NonZero::<u128>::MAX on overflow.
ยงExamples
let three = NonZero::new(3u128)?;
let twenty_seven = NonZero::new(27u128)?;
let max = NonZero::new(u128::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<u128>
impl NonZero<u128>
1.92.0 (const: 1.92.0) ยท Sourcepub const fn div_ceil(self, rhs: NonZero<u128>) -> NonZero<u128>
pub const fn div_ceil(self, rhs: NonZero<u128>) -> NonZero<u128>
Calculates the quotient of self and rhs, rounding the result towards positive infinity.
The result is guaranteed to be non-zero.
ยงExamples
let one = NonZero::new(1u128).unwrap();
let max = NonZero::new(u128::MAX).unwrap();
assert_eq!(one.div_ceil(max), one);
let two = NonZero::new(2u128).unwrap();
let three = NonZero::new(3u128).unwrap();
assert_eq!(three.div_ceil(two), two);Sourceยงimpl NonZero<usize>
impl NonZero<usize>
1.67.0 ยท Sourcepub const BITS: u32 = 64u32
pub const BITS: u32 = 64u32
The size of this non-zero integer type in bits.
This value is equal to usize::BITS.
ยงExamples
assert_eq!(NonZero::<usize>::BITS, usize::BITS);1.70.0 ยท Sourcepub const MIN: NonZero<usize>
pub const MIN: NonZero<usize>
The smallest value that can be represented by this non-zero integer type, 1.
ยงExamples
assert_eq!(NonZero::<usize>::MIN.get(), 1usize);1.70.0 ยท Sourcepub const MAX: NonZero<usize>
pub const MAX: NonZero<usize>
The largest value that can be represented by this non-zero
integer type,
equal to usize::MAX.
ยงExamples
assert_eq!(NonZero::<usize>::MAX.get(), usize::MAX);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<usize>::new(usize::MAX)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<usize>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<usize>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<usize>::new(0b_01100100)?;
let b = NonZero::<usize>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<usize>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<usize>::new(0b_01100100)?;
let b = NonZero::<usize>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<usize>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<usize>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<usize>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<usize>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<usize>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<usize>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<usize>::new(0b100_0000)?;
let b = NonZero::<usize>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<usize>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xaa00000000006e1usize)?;
let m = NonZero::new(0x6e10aa)?;
assert_eq!(n.rotate_left(12), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<usize>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x6e10aausize)?;
let m = NonZero::new(0xaa00000000006e1)?;
assert_eq!(n.rotate_right(12), m);Sourcepub const fn swap_bytes(self) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<usize>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234567890123456usize)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x5634129078563412)?);Sourcepub const fn reverse_bits(self) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<usize>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234567890123456usize)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x6a2c48091e6a2c48)?);Sourcepub const fn from_be(x: NonZero<usize>) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<usize>) -> NonZero<usize>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroUsize;
let n = NonZero::new(0x1Ausize)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroUsize::from_be(n), n)
} else {
assert_eq!(NonZeroUsize::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<usize>) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<usize>) -> NonZero<usize>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroUsize;
let n = NonZero::new(0x1Ausize)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroUsize::from_le(n), n)
} else {
assert_eq!(NonZeroUsize::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<usize>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ausize)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<usize>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ausize)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_add(self, other: usize) -> Option<NonZero<usize>>
pub const fn checked_add(self, other: usize) -> Option<NonZero<usize>>
Adds an unsigned integer to a non-zero value.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let one = NonZero::new(1usize)?;
let two = NonZero::new(2usize)?;
let max = NonZero::new(usize::MAX)?;
assert_eq!(Some(two), one.checked_add(1));
assert_eq!(None, max.checked_add(1));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_add(self, other: usize) -> NonZero<usize>
pub const fn saturating_add(self, other: usize) -> NonZero<usize>
Adds an unsigned integer to a non-zero value.
Return NonZero::<usize>::MAX on overflow.
ยงExamples
let one = NonZero::new(1usize)?;
let two = NonZero::new(2usize)?;
let max = NonZero::new(usize::MAX)?;
assert_eq!(two, one.saturating_add(1));
assert_eq!(max, max.saturating_add(1));Sourcepub const unsafe fn unchecked_add(self, other: usize) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_add(self, other: usize) -> NonZero<usize>
nonzero_ops)Adds 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
#![feature(nonzero_ops)]
let one = NonZero::new(1usize)?;
let two = NonZero::new(2usize)?;
assert_eq!(two, unsafe { one.unchecked_add(1) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_next_power_of_two(self) -> Option<NonZero<usize>>
pub const fn checked_next_power_of_two(self) -> Option<NonZero<usize>>
Returns the smallest power of two greater than or equal to self.
Checks for overflow and returns None
if the next power of two is greater than the typeโs maximum value.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2usize)?;
let three = NonZero::new(3usize)?;
let four = NonZero::new(4usize)?;
let max = NonZero::new(usize::MAX)?;
assert_eq!(Some(two), two.checked_next_power_of_two() );
assert_eq!(Some(four), three.checked_next_power_of_two() );
assert_eq!(None, max.checked_next_power_of_two() );1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog2(self) -> u32
pub const fn ilog2(self) -> u32
Returns 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
assert_eq!(NonZero::new(7usize)?.ilog2(), 2);
assert_eq!(NonZero::new(8usize)?.ilog2(), 3);
assert_eq!(NonZero::new(9usize)?.ilog2(), 3);1.67.0 (const: 1.67.0) ยท Sourcepub const fn ilog10(self) -> u32
pub const fn ilog10(self) -> u32
Returns 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
assert_eq!(NonZero::new(99usize)?.ilog10(), 1);
assert_eq!(NonZero::new(100usize)?.ilog10(), 2);
assert_eq!(NonZero::new(101usize)?.ilog10(), 2);1.85.0 (const: 1.85.0) ยท Sourcepub const fn midpoint(self, rhs: NonZero<usize>) -> NonZero<usize>
pub const fn midpoint(self, rhs: NonZero<usize>) -> NonZero<usize>
Calculates the midpoint (average) between self and rhs.
midpoint(a, b) is (a + b) >> 1 as 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
let one = NonZero::new(1usize)?;
let two = NonZero::new(2usize)?;
let four = NonZero::new(4usize)?;
assert_eq!(one.midpoint(four), two);
assert_eq!(four.midpoint(one), two);1.59.0 (const: 1.59.0) ยท Sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == (1 << k) for some k.
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
let eight = NonZero::new(8usize)?;
assert!(eight.is_power_of_two());
let ten = NonZero::new(10usize)?;
assert!(!ten.is_power_of_two());1.84.0 (const: 1.84.0) ยท Sourcepub const fn isqrt(self) -> NonZero<usize>
pub const fn isqrt(self) -> NonZero<usize>
Returns the square root of the number, rounded down.
ยงExamples
let ten = NonZero::new(10usize)?;
let three = NonZero::new(3usize)?;
assert_eq!(ten.isqrt(), three);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_signed(self) -> NonZero<isize>
pub const fn cast_signed(self) -> NonZero<isize>
Returns the bit pattern of self reinterpreted as a signed integer of the same size.
ยงExamples
let n = NonZero::<usize>::MAX;
assert_eq!(n.cast_signed(), NonZero::new(-1isize).unwrap());Sourcepub const fn bit_width(self) -> NonZero<u32>
๐ฌThis is a nightly-only experimental API. (uint_bit_width)
pub const fn bit_width(self) -> NonZero<u32>
uint_bit_width)Returns the minimum number of bits required to represent self.
ยงExamples
#![feature(uint_bit_width)]
assert_eq!(NonZero::<usize>::MIN.bit_width(), NonZero::new(1)?);
assert_eq!(NonZero::<usize>::new(0b111)?.bit_width(), NonZero::new(3)?);
assert_eq!(NonZero::<usize>::new(0b1110)?.bit_width(), NonZero::new(4)?);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<usize>) -> Option<NonZero<usize>>
pub const fn checked_mul(self, other: NonZero<usize>) -> Option<NonZero<usize>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2usize)?;
let four = NonZero::new(4usize)?;
let max = NonZero::new(usize::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<usize>) -> NonZero<usize>
pub const fn saturating_mul(self, other: NonZero<usize>) -> NonZero<usize>
Multiplies two non-zero integers together.
Return NonZero::<usize>::MAX on overflow.
ยงExamples
let two = NonZero::new(2usize)?;
let four = NonZero::new(4usize)?;
let max = NonZero::new(usize::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<usize>) -> NonZero<usize>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<usize>) -> NonZero<usize>
nonzero_ops)Multiplies 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
#![feature(nonzero_ops)]
let two = NonZero::new(2usize)?;
let four = NonZero::new(4usize)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<usize>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<usize>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3usize)?;
let twenty_seven = NonZero::new(27usize)?;
let half_max = NonZero::new(usize::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<usize>
pub const fn saturating_pow(self, other: u32) -> NonZero<usize>
Raise non-zero value to an integer power.
Return NonZero::<usize>::MAX on overflow.
ยงExamples
let three = NonZero::new(3usize)?;
let twenty_seven = NonZero::new(27usize)?;
let max = NonZero::new(usize::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<usize>
impl NonZero<usize>
1.92.0 (const: 1.92.0) ยท Sourcepub const fn div_ceil(self, rhs: NonZero<usize>) -> NonZero<usize>
pub const fn div_ceil(self, rhs: NonZero<usize>) -> NonZero<usize>
Calculates the quotient of self and rhs, rounding the result towards positive infinity.
The result is guaranteed to be non-zero.
ยงExamples
let one = NonZero::new(1usize).unwrap();
let max = NonZero::new(usize::MAX).unwrap();
assert_eq!(one.div_ceil(max), one);
let two = NonZero::new(2usize).unwrap();
let three = NonZero::new(3usize).unwrap();
assert_eq!(three.div_ceil(two), two);Sourceยงimpl NonZero<i8>
impl NonZero<i8>
1.70.0 ยท Sourcepub const MIN: NonZero<i8>
pub const MIN: NonZero<i8>
The smallest value that can be represented by this non-zero
integer type,
equal to i8::MIN.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i8>::MIN.get(), i8::MIN);1.70.0 ยท Sourcepub const MAX: NonZero<i8>
pub const MAX: NonZero<i8>
The largest value that can be represented by this non-zero
integer type,
equal to i8::MAX.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i8>::MAX.get(), i8::MAX);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<i8>::new(-1i8)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<i8>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<i8>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i8>::new(0b_01100100)?;
let b = NonZero::<i8>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<i8>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i8>::new(0b_01100100)?;
let b = NonZero::<i8>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i8>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<i8>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<i8>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i8>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<i8>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<i8>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<i8>::new(0b100_0000)?;
let b = NonZero::<i8>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<i8>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(-0x7ei8)?;
let m = NonZero::new(0xa)?;
assert_eq!(n.rotate_left(2), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<i8>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xai8)?;
let m = NonZero::new(-0x7e)?;
assert_eq!(n.rotate_right(2), m);Sourcepub const fn swap_bytes(self) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<i8>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12i8)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x12)?);Sourcepub const fn reverse_bits(self) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<i8>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12i8)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x48)?);Sourcepub const fn from_be(x: NonZero<i8>) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<i8>) -> NonZero<i8>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI8;
let n = NonZero::new(0x1Ai8)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroI8::from_be(n), n)
} else {
assert_eq!(NonZeroI8::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<i8>) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<i8>) -> NonZero<i8>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI8;
let n = NonZero::new(0x1Ai8)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroI8::from_le(n), n)
} else {
assert_eq!(NonZeroI8::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<i8>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai8)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<i8>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai8)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_abs(self) -> Option<NonZero<i8>>
pub const fn checked_abs(self) -> Option<NonZero<i8>>
Checked absolute value.
Checks for overflow and returns None if
self == NonZero::<i8>::MIN.
The result cannot be zero.
ยงExample
let pos = NonZero::new(1i8)?;
let neg = NonZero::new(-1i8)?;
let min = NonZero::new(i8::MIN)?;
assert_eq!(Some(pos), neg.checked_abs());
assert_eq!(None, min.checked_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn overflowing_abs(self) -> (NonZero<i8>, bool)
pub const fn overflowing_abs(self) -> (NonZero<i8>, bool)
Computes the absolute value of self,
with overflow information, see
i8::overflowing_abs.
ยงExample
let pos = NonZero::new(1i8)?;
let neg = NonZero::new(-1i8)?;
let min = NonZero::new(i8::MIN)?;
assert_eq!((pos, false), pos.overflowing_abs());
assert_eq!((pos, false), neg.overflowing_abs());
assert_eq!((min, true), min.overflowing_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_abs(self) -> NonZero<i8>
pub const fn saturating_abs(self) -> NonZero<i8>
Saturating absolute value, see
i8::saturating_abs.
ยงExample
let pos = NonZero::new(1i8)?;
let neg = NonZero::new(-1i8)?;
let min = NonZero::new(i8::MIN)?;
let min_plus = NonZero::new(i8::MIN + 1)?;
let max = NonZero::new(i8::MAX)?;
assert_eq!(pos, pos.saturating_abs());
assert_eq!(pos, neg.saturating_abs());
assert_eq!(max, min.saturating_abs());
assert_eq!(max, min_plus.saturating_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn wrapping_abs(self) -> NonZero<i8>
pub const fn wrapping_abs(self) -> NonZero<i8>
Wrapping absolute value, see
i8::wrapping_abs.
ยงExample
let pos = NonZero::new(1i8)?;
let neg = NonZero::new(-1i8)?;
let min = NonZero::new(i8::MIN)?;
assert_eq!(pos, pos.wrapping_abs());
assert_eq!(pos, neg.wrapping_abs());
assert_eq!(min, min.wrapping_abs());
assert_eq!(max, (-max).wrapping_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn unsigned_abs(self) -> NonZero<u8>
pub const fn unsigned_abs(self) -> NonZero<u8>
Computes the absolute value of self without any wrapping or panicking.
ยงExample
let u_pos = NonZero::new(1u8)?;
let i_pos = NonZero::new(1i8)?;
let i_neg = NonZero::new(-1i8)?;
let i_min = NonZero::new(i8::MIN)?;
let u_max = NonZero::new(u8::MAX / 2 + 1)?;
assert_eq!(u_pos, i_pos.unsigned_abs());
assert_eq!(u_pos, i_neg.unsigned_abs());
assert_eq!(u_max, i_min.unsigned_abs());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Returns true if self is positive and false if the
number is negative.
ยงExample
let pos_five = NonZero::new(5i8)?;
let neg_five = NonZero::new(-5i8)?;
assert!(pos_five.is_positive());
assert!(!neg_five.is_positive());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Returns true if self is negative and false if the
number is positive.
ยงExample
let pos_five = NonZero::new(5i8)?;
let neg_five = NonZero::new(-5i8)?;
assert!(neg_five.is_negative());
assert!(!pos_five.is_negative());1.71.0 (const: 1.71.0) ยท Sourcepub const fn checked_neg(self) -> Option<NonZero<i8>>
pub const fn checked_neg(self) -> Option<NonZero<i8>>
Checked negation. Computes -self,
returning None if self == NonZero::<i8>::MIN.
ยงExample
let pos_five = NonZero::new(5i8)?;
let neg_five = NonZero::new(-5i8)?;
let min = NonZero::new(i8::MIN)?;
assert_eq!(pos_five.checked_neg(), Some(neg_five));
assert_eq!(min.checked_neg(), None);1.71.0 (const: 1.71.0) ยท Sourcepub const fn overflowing_neg(self) -> (NonZero<i8>, bool)
pub const fn overflowing_neg(self) -> (NonZero<i8>, bool)
Negates self, overflowing if this is equal to the minimum value.
See i8::overflowing_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i8)?;
let neg_five = NonZero::new(-5i8)?;
let min = NonZero::new(i8::MIN)?;
assert_eq!(pos_five.overflowing_neg(), (neg_five, false));
assert_eq!(min.overflowing_neg(), (min, true));1.71.0 (const: 1.71.0) ยท Sourcepub const fn saturating_neg(self) -> NonZero<i8>
pub const fn saturating_neg(self) -> NonZero<i8>
Saturating negation. Computes -self,
returning NonZero::<i8>::MAX
if self == NonZero::<i8>::MIN
instead of overflowing.
ยงExample
let pos_five = NonZero::new(5i8)?;
let neg_five = NonZero::new(-5i8)?;
let min = NonZero::new(i8::MIN)?;
let min_plus_one = NonZero::new(i8::MIN + 1)?;
let max = NonZero::new(i8::MAX)?;
assert_eq!(pos_five.saturating_neg(), neg_five);
assert_eq!(min.saturating_neg(), max);
assert_eq!(max.saturating_neg(), min_plus_one);1.71.0 (const: 1.71.0) ยท Sourcepub const fn wrapping_neg(self) -> NonZero<i8>
pub const fn wrapping_neg(self) -> NonZero<i8>
Wrapping (modular) negation. Computes -self, wrapping around at the boundary
of the type.
See i8::wrapping_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i8)?;
let neg_five = NonZero::new(-5i8)?;
let min = NonZero::new(i8::MIN)?;
assert_eq!(pos_five.wrapping_neg(), neg_five);
assert_eq!(min.wrapping_neg(), min);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_unsigned(self) -> NonZero<u8>
pub const fn cast_unsigned(self) -> NonZero<u8>
Returns the bit pattern of self reinterpreted as an unsigned integer of the same size.
ยงExamples
let n = NonZero::new(-1i8).unwrap();
assert_eq!(n.cast_unsigned(), NonZero::<u8>::MAX);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<i8>) -> Option<NonZero<i8>>
pub const fn checked_mul(self, other: NonZero<i8>) -> Option<NonZero<i8>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2i8)?;
let four = NonZero::new(4i8)?;
let max = NonZero::new(i8::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<i8>) -> NonZero<i8>
pub const fn saturating_mul(self, other: NonZero<i8>) -> NonZero<i8>
Multiplies two non-zero integers together.
Return NonZero::<i8>::MAX on overflow.
ยงExamples
let two = NonZero::new(2i8)?;
let four = NonZero::new(4i8)?;
let max = NonZero::new(i8::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<i8>) -> NonZero<i8>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<i8>) -> NonZero<i8>
nonzero_ops)Multiplies 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, or self * rhs < i8::MIN.
ยงExamples
#![feature(nonzero_ops)]
let two = NonZero::new(2i8)?;
let four = NonZero::new(4i8)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<i8>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<i8>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3i8)?;
let twenty_seven = NonZero::new(27i8)?;
let half_max = NonZero::new(i8::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<i8>
pub const fn saturating_pow(self, other: u32) -> NonZero<i8>
Raise non-zero value to an integer power.
Return NonZero::<i8>::MIN or NonZero::<i8>::MAX on overflow.
ยงExamples
let three = NonZero::new(3i8)?;
let twenty_seven = NonZero::new(27i8)?;
let max = NonZero::new(i8::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<i16>
impl NonZero<i16>
1.70.0 ยท Sourcepub const MIN: NonZero<i16>
pub const MIN: NonZero<i16>
The smallest value that can be represented by this non-zero
integer type,
equal to i16::MIN.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i16>::MIN.get(), i16::MIN);1.70.0 ยท Sourcepub const MAX: NonZero<i16>
pub const MAX: NonZero<i16>
The largest value that can be represented by this non-zero
integer type,
equal to i16::MAX.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i16>::MAX.get(), i16::MAX);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<i16>::new(-1i16)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<i16>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<i16>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i16>::new(0b_01100100)?;
let b = NonZero::<i16>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<i16>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i16>::new(0b_01100100)?;
let b = NonZero::<i16>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i16>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<i16>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<i16>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i16>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<i16>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<i16>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<i16>::new(0b100_0000)?;
let b = NonZero::<i16>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<i16>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(-0x5ffdi16)?;
let m = NonZero::new(0x3a)?;
assert_eq!(n.rotate_left(4), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<i16>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x3ai16)?;
let m = NonZero::new(-0x5ffd)?;
assert_eq!(n.rotate_right(4), m);Sourcepub const fn swap_bytes(self) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<i16>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234i16)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x3412)?);Sourcepub const fn reverse_bits(self) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<i16>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234i16)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x2c48)?);Sourcepub const fn from_be(x: NonZero<i16>) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<i16>) -> NonZero<i16>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI16;
let n = NonZero::new(0x1Ai16)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroI16::from_be(n), n)
} else {
assert_eq!(NonZeroI16::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<i16>) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<i16>) -> NonZero<i16>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI16;
let n = NonZero::new(0x1Ai16)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroI16::from_le(n), n)
} else {
assert_eq!(NonZeroI16::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<i16>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai16)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<i16>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai16)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_abs(self) -> Option<NonZero<i16>>
pub const fn checked_abs(self) -> Option<NonZero<i16>>
Checked absolute value.
Checks for overflow and returns None if
self == NonZero::<i16>::MIN.
The result cannot be zero.
ยงExample
let pos = NonZero::new(1i16)?;
let neg = NonZero::new(-1i16)?;
let min = NonZero::new(i16::MIN)?;
assert_eq!(Some(pos), neg.checked_abs());
assert_eq!(None, min.checked_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn overflowing_abs(self) -> (NonZero<i16>, bool)
pub const fn overflowing_abs(self) -> (NonZero<i16>, bool)
Computes the absolute value of self,
with overflow information, see
i16::overflowing_abs.
ยงExample
let pos = NonZero::new(1i16)?;
let neg = NonZero::new(-1i16)?;
let min = NonZero::new(i16::MIN)?;
assert_eq!((pos, false), pos.overflowing_abs());
assert_eq!((pos, false), neg.overflowing_abs());
assert_eq!((min, true), min.overflowing_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_abs(self) -> NonZero<i16>
pub const fn saturating_abs(self) -> NonZero<i16>
Saturating absolute value, see
i16::saturating_abs.
ยงExample
let pos = NonZero::new(1i16)?;
let neg = NonZero::new(-1i16)?;
let min = NonZero::new(i16::MIN)?;
let min_plus = NonZero::new(i16::MIN + 1)?;
let max = NonZero::new(i16::MAX)?;
assert_eq!(pos, pos.saturating_abs());
assert_eq!(pos, neg.saturating_abs());
assert_eq!(max, min.saturating_abs());
assert_eq!(max, min_plus.saturating_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn wrapping_abs(self) -> NonZero<i16>
pub const fn wrapping_abs(self) -> NonZero<i16>
Wrapping absolute value, see
i16::wrapping_abs.
ยงExample
let pos = NonZero::new(1i16)?;
let neg = NonZero::new(-1i16)?;
let min = NonZero::new(i16::MIN)?;
assert_eq!(pos, pos.wrapping_abs());
assert_eq!(pos, neg.wrapping_abs());
assert_eq!(min, min.wrapping_abs());
assert_eq!(max, (-max).wrapping_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn unsigned_abs(self) -> NonZero<u16>
pub const fn unsigned_abs(self) -> NonZero<u16>
Computes the absolute value of self without any wrapping or panicking.
ยงExample
let u_pos = NonZero::new(1u16)?;
let i_pos = NonZero::new(1i16)?;
let i_neg = NonZero::new(-1i16)?;
let i_min = NonZero::new(i16::MIN)?;
let u_max = NonZero::new(u16::MAX / 2 + 1)?;
assert_eq!(u_pos, i_pos.unsigned_abs());
assert_eq!(u_pos, i_neg.unsigned_abs());
assert_eq!(u_max, i_min.unsigned_abs());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Returns true if self is positive and false if the
number is negative.
ยงExample
let pos_five = NonZero::new(5i16)?;
let neg_five = NonZero::new(-5i16)?;
assert!(pos_five.is_positive());
assert!(!neg_five.is_positive());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Returns true if self is negative and false if the
number is positive.
ยงExample
let pos_five = NonZero::new(5i16)?;
let neg_five = NonZero::new(-5i16)?;
assert!(neg_five.is_negative());
assert!(!pos_five.is_negative());1.71.0 (const: 1.71.0) ยท Sourcepub const fn checked_neg(self) -> Option<NonZero<i16>>
pub const fn checked_neg(self) -> Option<NonZero<i16>>
Checked negation. Computes -self,
returning None if self == NonZero::<i16>::MIN.
ยงExample
let pos_five = NonZero::new(5i16)?;
let neg_five = NonZero::new(-5i16)?;
let min = NonZero::new(i16::MIN)?;
assert_eq!(pos_five.checked_neg(), Some(neg_five));
assert_eq!(min.checked_neg(), None);1.71.0 (const: 1.71.0) ยท Sourcepub const fn overflowing_neg(self) -> (NonZero<i16>, bool)
pub const fn overflowing_neg(self) -> (NonZero<i16>, bool)
Negates self, overflowing if this is equal to the minimum value.
See i16::overflowing_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i16)?;
let neg_five = NonZero::new(-5i16)?;
let min = NonZero::new(i16::MIN)?;
assert_eq!(pos_five.overflowing_neg(), (neg_five, false));
assert_eq!(min.overflowing_neg(), (min, true));1.71.0 (const: 1.71.0) ยท Sourcepub const fn saturating_neg(self) -> NonZero<i16>
pub const fn saturating_neg(self) -> NonZero<i16>
Saturating negation. Computes -self,
returning NonZero::<i16>::MAX
if self == NonZero::<i16>::MIN
instead of overflowing.
ยงExample
let pos_five = NonZero::new(5i16)?;
let neg_five = NonZero::new(-5i16)?;
let min = NonZero::new(i16::MIN)?;
let min_plus_one = NonZero::new(i16::MIN + 1)?;
let max = NonZero::new(i16::MAX)?;
assert_eq!(pos_five.saturating_neg(), neg_five);
assert_eq!(min.saturating_neg(), max);
assert_eq!(max.saturating_neg(), min_plus_one);1.71.0 (const: 1.71.0) ยท Sourcepub const fn wrapping_neg(self) -> NonZero<i16>
pub const fn wrapping_neg(self) -> NonZero<i16>
Wrapping (modular) negation. Computes -self, wrapping around at the boundary
of the type.
See i16::wrapping_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i16)?;
let neg_five = NonZero::new(-5i16)?;
let min = NonZero::new(i16::MIN)?;
assert_eq!(pos_five.wrapping_neg(), neg_five);
assert_eq!(min.wrapping_neg(), min);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_unsigned(self) -> NonZero<u16>
pub const fn cast_unsigned(self) -> NonZero<u16>
Returns the bit pattern of self reinterpreted as an unsigned integer of the same size.
ยงExamples
let n = NonZero::new(-1i16).unwrap();
assert_eq!(n.cast_unsigned(), NonZero::<u16>::MAX);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<i16>) -> Option<NonZero<i16>>
pub const fn checked_mul(self, other: NonZero<i16>) -> Option<NonZero<i16>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2i16)?;
let four = NonZero::new(4i16)?;
let max = NonZero::new(i16::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<i16>) -> NonZero<i16>
pub const fn saturating_mul(self, other: NonZero<i16>) -> NonZero<i16>
Multiplies two non-zero integers together.
Return NonZero::<i16>::MAX on overflow.
ยงExamples
let two = NonZero::new(2i16)?;
let four = NonZero::new(4i16)?;
let max = NonZero::new(i16::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<i16>) -> NonZero<i16>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<i16>) -> NonZero<i16>
nonzero_ops)Multiplies 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, or self * rhs < i16::MIN.
ยงExamples
#![feature(nonzero_ops)]
let two = NonZero::new(2i16)?;
let four = NonZero::new(4i16)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<i16>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<i16>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3i16)?;
let twenty_seven = NonZero::new(27i16)?;
let half_max = NonZero::new(i16::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<i16>
pub const fn saturating_pow(self, other: u32) -> NonZero<i16>
Raise non-zero value to an integer power.
Return NonZero::<i16>::MIN or NonZero::<i16>::MAX on overflow.
ยงExamples
let three = NonZero::new(3i16)?;
let twenty_seven = NonZero::new(27i16)?;
let max = NonZero::new(i16::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<i32>
impl NonZero<i32>
1.70.0 ยท Sourcepub const MIN: NonZero<i32>
pub const MIN: NonZero<i32>
The smallest value that can be represented by this non-zero
integer type,
equal to i32::MIN.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i32>::MIN.get(), i32::MIN);1.70.0 ยท Sourcepub const MAX: NonZero<i32>
pub const MAX: NonZero<i32>
The largest value that can be represented by this non-zero
integer type,
equal to i32::MAX.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i32>::MAX.get(), i32::MAX);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<i32>::new(-1i32)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<i32>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<i32>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i32>::new(0b_01100100)?;
let b = NonZero::<i32>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<i32>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i32>::new(0b_01100100)?;
let b = NonZero::<i32>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i32>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<i32>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<i32>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i32>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<i32>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<i32>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<i32>::new(0b100_0000)?;
let b = NonZero::<i32>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<i32>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x10000b3i32)?;
let m = NonZero::new(0xb301)?;
assert_eq!(n.rotate_left(8), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<i32>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xb301i32)?;
let m = NonZero::new(0x10000b3)?;
assert_eq!(n.rotate_right(8), m);Sourcepub const fn swap_bytes(self) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<i32>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12345678i32)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x78563412)?);Sourcepub const fn reverse_bits(self) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<i32>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12345678i32)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x1e6a2c48)?);Sourcepub const fn from_be(x: NonZero<i32>) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<i32>) -> NonZero<i32>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI32;
let n = NonZero::new(0x1Ai32)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroI32::from_be(n), n)
} else {
assert_eq!(NonZeroI32::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<i32>) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<i32>) -> NonZero<i32>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI32;
let n = NonZero::new(0x1Ai32)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroI32::from_le(n), n)
} else {
assert_eq!(NonZeroI32::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<i32>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai32)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<i32>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai32)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_abs(self) -> Option<NonZero<i32>>
pub const fn checked_abs(self) -> Option<NonZero<i32>>
Checked absolute value.
Checks for overflow and returns None if
self == NonZero::<i32>::MIN.
The result cannot be zero.
ยงExample
let pos = NonZero::new(1i32)?;
let neg = NonZero::new(-1i32)?;
let min = NonZero::new(i32::MIN)?;
assert_eq!(Some(pos), neg.checked_abs());
assert_eq!(None, min.checked_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn overflowing_abs(self) -> (NonZero<i32>, bool)
pub const fn overflowing_abs(self) -> (NonZero<i32>, bool)
Computes the absolute value of self,
with overflow information, see
i32::overflowing_abs.
ยงExample
let pos = NonZero::new(1i32)?;
let neg = NonZero::new(-1i32)?;
let min = NonZero::new(i32::MIN)?;
assert_eq!((pos, false), pos.overflowing_abs());
assert_eq!((pos, false), neg.overflowing_abs());
assert_eq!((min, true), min.overflowing_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_abs(self) -> NonZero<i32>
pub const fn saturating_abs(self) -> NonZero<i32>
Saturating absolute value, see
i32::saturating_abs.
ยงExample
let pos = NonZero::new(1i32)?;
let neg = NonZero::new(-1i32)?;
let min = NonZero::new(i32::MIN)?;
let min_plus = NonZero::new(i32::MIN + 1)?;
let max = NonZero::new(i32::MAX)?;
assert_eq!(pos, pos.saturating_abs());
assert_eq!(pos, neg.saturating_abs());
assert_eq!(max, min.saturating_abs());
assert_eq!(max, min_plus.saturating_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn wrapping_abs(self) -> NonZero<i32>
pub const fn wrapping_abs(self) -> NonZero<i32>
Wrapping absolute value, see
i32::wrapping_abs.
ยงExample
let pos = NonZero::new(1i32)?;
let neg = NonZero::new(-1i32)?;
let min = NonZero::new(i32::MIN)?;
assert_eq!(pos, pos.wrapping_abs());
assert_eq!(pos, neg.wrapping_abs());
assert_eq!(min, min.wrapping_abs());
assert_eq!(max, (-max).wrapping_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn unsigned_abs(self) -> NonZero<u32>
pub const fn unsigned_abs(self) -> NonZero<u32>
Computes the absolute value of self without any wrapping or panicking.
ยงExample
let u_pos = NonZero::new(1u32)?;
let i_pos = NonZero::new(1i32)?;
let i_neg = NonZero::new(-1i32)?;
let i_min = NonZero::new(i32::MIN)?;
let u_max = NonZero::new(u32::MAX / 2 + 1)?;
assert_eq!(u_pos, i_pos.unsigned_abs());
assert_eq!(u_pos, i_neg.unsigned_abs());
assert_eq!(u_max, i_min.unsigned_abs());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Returns true if self is positive and false if the
number is negative.
ยงExample
let pos_five = NonZero::new(5i32)?;
let neg_five = NonZero::new(-5i32)?;
assert!(pos_five.is_positive());
assert!(!neg_five.is_positive());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Returns true if self is negative and false if the
number is positive.
ยงExample
let pos_five = NonZero::new(5i32)?;
let neg_five = NonZero::new(-5i32)?;
assert!(neg_five.is_negative());
assert!(!pos_five.is_negative());1.71.0 (const: 1.71.0) ยท Sourcepub const fn checked_neg(self) -> Option<NonZero<i32>>
pub const fn checked_neg(self) -> Option<NonZero<i32>>
Checked negation. Computes -self,
returning None if self == NonZero::<i32>::MIN.
ยงExample
let pos_five = NonZero::new(5i32)?;
let neg_five = NonZero::new(-5i32)?;
let min = NonZero::new(i32::MIN)?;
assert_eq!(pos_five.checked_neg(), Some(neg_five));
assert_eq!(min.checked_neg(), None);1.71.0 (const: 1.71.0) ยท Sourcepub const fn overflowing_neg(self) -> (NonZero<i32>, bool)
pub const fn overflowing_neg(self) -> (NonZero<i32>, bool)
Negates self, overflowing if this is equal to the minimum value.
See i32::overflowing_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i32)?;
let neg_five = NonZero::new(-5i32)?;
let min = NonZero::new(i32::MIN)?;
assert_eq!(pos_five.overflowing_neg(), (neg_five, false));
assert_eq!(min.overflowing_neg(), (min, true));1.71.0 (const: 1.71.0) ยท Sourcepub const fn saturating_neg(self) -> NonZero<i32>
pub const fn saturating_neg(self) -> NonZero<i32>
Saturating negation. Computes -self,
returning NonZero::<i32>::MAX
if self == NonZero::<i32>::MIN
instead of overflowing.
ยงExample
let pos_five = NonZero::new(5i32)?;
let neg_five = NonZero::new(-5i32)?;
let min = NonZero::new(i32::MIN)?;
let min_plus_one = NonZero::new(i32::MIN + 1)?;
let max = NonZero::new(i32::MAX)?;
assert_eq!(pos_five.saturating_neg(), neg_five);
assert_eq!(min.saturating_neg(), max);
assert_eq!(max.saturating_neg(), min_plus_one);1.71.0 (const: 1.71.0) ยท Sourcepub const fn wrapping_neg(self) -> NonZero<i32>
pub const fn wrapping_neg(self) -> NonZero<i32>
Wrapping (modular) negation. Computes -self, wrapping around at the boundary
of the type.
See i32::wrapping_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i32)?;
let neg_five = NonZero::new(-5i32)?;
let min = NonZero::new(i32::MIN)?;
assert_eq!(pos_five.wrapping_neg(), neg_five);
assert_eq!(min.wrapping_neg(), min);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_unsigned(self) -> NonZero<u32>
pub const fn cast_unsigned(self) -> NonZero<u32>
Returns the bit pattern of self reinterpreted as an unsigned integer of the same size.
ยงExamples
let n = NonZero::new(-1i32).unwrap();
assert_eq!(n.cast_unsigned(), NonZero::<u32>::MAX);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<i32>) -> Option<NonZero<i32>>
pub const fn checked_mul(self, other: NonZero<i32>) -> Option<NonZero<i32>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2i32)?;
let four = NonZero::new(4i32)?;
let max = NonZero::new(i32::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<i32>) -> NonZero<i32>
pub const fn saturating_mul(self, other: NonZero<i32>) -> NonZero<i32>
Multiplies two non-zero integers together.
Return NonZero::<i32>::MAX on overflow.
ยงExamples
let two = NonZero::new(2i32)?;
let four = NonZero::new(4i32)?;
let max = NonZero::new(i32::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<i32>) -> NonZero<i32>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<i32>) -> NonZero<i32>
nonzero_ops)Multiplies 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, or self * rhs < i32::MIN.
ยงExamples
#![feature(nonzero_ops)]
let two = NonZero::new(2i32)?;
let four = NonZero::new(4i32)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<i32>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<i32>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3i32)?;
let twenty_seven = NonZero::new(27i32)?;
let half_max = NonZero::new(i32::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<i32>
pub const fn saturating_pow(self, other: u32) -> NonZero<i32>
Raise non-zero value to an integer power.
Return NonZero::<i32>::MIN or NonZero::<i32>::MAX on overflow.
ยงExamples
let three = NonZero::new(3i32)?;
let twenty_seven = NonZero::new(27i32)?;
let max = NonZero::new(i32::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<i64>
impl NonZero<i64>
1.70.0 ยท Sourcepub const MIN: NonZero<i64>
pub const MIN: NonZero<i64>
The smallest value that can be represented by this non-zero
integer type,
equal to i64::MIN.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i64>::MIN.get(), i64::MIN);1.70.0 ยท Sourcepub const MAX: NonZero<i64>
pub const MAX: NonZero<i64>
The largest value that can be represented by this non-zero
integer type,
equal to i64::MAX.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i64>::MAX.get(), i64::MAX);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<i64>::new(-1i64)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<i64>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<i64>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i64>::new(0b_01100100)?;
let b = NonZero::<i64>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<i64>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i64>::new(0b_01100100)?;
let b = NonZero::<i64>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i64>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<i64>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<i64>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i64>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<i64>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<i64>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<i64>::new(0b100_0000)?;
let b = NonZero::<i64>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<i64>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xaa00000000006e1i64)?;
let m = NonZero::new(0x6e10aa)?;
assert_eq!(n.rotate_left(12), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<i64>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x6e10aai64)?;
let m = NonZero::new(0xaa00000000006e1)?;
assert_eq!(n.rotate_right(12), m);Sourcepub const fn swap_bytes(self) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<i64>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234567890123456i64)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x5634129078563412)?);Sourcepub const fn reverse_bits(self) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<i64>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234567890123456i64)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x6a2c48091e6a2c48)?);Sourcepub const fn from_be(x: NonZero<i64>) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<i64>) -> NonZero<i64>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI64;
let n = NonZero::new(0x1Ai64)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroI64::from_be(n), n)
} else {
assert_eq!(NonZeroI64::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<i64>) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<i64>) -> NonZero<i64>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI64;
let n = NonZero::new(0x1Ai64)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroI64::from_le(n), n)
} else {
assert_eq!(NonZeroI64::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<i64>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai64)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<i64>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai64)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_abs(self) -> Option<NonZero<i64>>
pub const fn checked_abs(self) -> Option<NonZero<i64>>
Checked absolute value.
Checks for overflow and returns None if
self == NonZero::<i64>::MIN.
The result cannot be zero.
ยงExample
let pos = NonZero::new(1i64)?;
let neg = NonZero::new(-1i64)?;
let min = NonZero::new(i64::MIN)?;
assert_eq!(Some(pos), neg.checked_abs());
assert_eq!(None, min.checked_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn overflowing_abs(self) -> (NonZero<i64>, bool)
pub const fn overflowing_abs(self) -> (NonZero<i64>, bool)
Computes the absolute value of self,
with overflow information, see
i64::overflowing_abs.
ยงExample
let pos = NonZero::new(1i64)?;
let neg = NonZero::new(-1i64)?;
let min = NonZero::new(i64::MIN)?;
assert_eq!((pos, false), pos.overflowing_abs());
assert_eq!((pos, false), neg.overflowing_abs());
assert_eq!((min, true), min.overflowing_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_abs(self) -> NonZero<i64>
pub const fn saturating_abs(self) -> NonZero<i64>
Saturating absolute value, see
i64::saturating_abs.
ยงExample
let pos = NonZero::new(1i64)?;
let neg = NonZero::new(-1i64)?;
let min = NonZero::new(i64::MIN)?;
let min_plus = NonZero::new(i64::MIN + 1)?;
let max = NonZero::new(i64::MAX)?;
assert_eq!(pos, pos.saturating_abs());
assert_eq!(pos, neg.saturating_abs());
assert_eq!(max, min.saturating_abs());
assert_eq!(max, min_plus.saturating_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn wrapping_abs(self) -> NonZero<i64>
pub const fn wrapping_abs(self) -> NonZero<i64>
Wrapping absolute value, see
i64::wrapping_abs.
ยงExample
let pos = NonZero::new(1i64)?;
let neg = NonZero::new(-1i64)?;
let min = NonZero::new(i64::MIN)?;
assert_eq!(pos, pos.wrapping_abs());
assert_eq!(pos, neg.wrapping_abs());
assert_eq!(min, min.wrapping_abs());
assert_eq!(max, (-max).wrapping_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn unsigned_abs(self) -> NonZero<u64>
pub const fn unsigned_abs(self) -> NonZero<u64>
Computes the absolute value of self without any wrapping or panicking.
ยงExample
let u_pos = NonZero::new(1u64)?;
let i_pos = NonZero::new(1i64)?;
let i_neg = NonZero::new(-1i64)?;
let i_min = NonZero::new(i64::MIN)?;
let u_max = NonZero::new(u64::MAX / 2 + 1)?;
assert_eq!(u_pos, i_pos.unsigned_abs());
assert_eq!(u_pos, i_neg.unsigned_abs());
assert_eq!(u_max, i_min.unsigned_abs());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Returns true if self is positive and false if the
number is negative.
ยงExample
let pos_five = NonZero::new(5i64)?;
let neg_five = NonZero::new(-5i64)?;
assert!(pos_five.is_positive());
assert!(!neg_five.is_positive());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Returns true if self is negative and false if the
number is positive.
ยงExample
let pos_five = NonZero::new(5i64)?;
let neg_five = NonZero::new(-5i64)?;
assert!(neg_five.is_negative());
assert!(!pos_five.is_negative());1.71.0 (const: 1.71.0) ยท Sourcepub const fn checked_neg(self) -> Option<NonZero<i64>>
pub const fn checked_neg(self) -> Option<NonZero<i64>>
Checked negation. Computes -self,
returning None if self == NonZero::<i64>::MIN.
ยงExample
let pos_five = NonZero::new(5i64)?;
let neg_five = NonZero::new(-5i64)?;
let min = NonZero::new(i64::MIN)?;
assert_eq!(pos_five.checked_neg(), Some(neg_five));
assert_eq!(min.checked_neg(), None);1.71.0 (const: 1.71.0) ยท Sourcepub const fn overflowing_neg(self) -> (NonZero<i64>, bool)
pub const fn overflowing_neg(self) -> (NonZero<i64>, bool)
Negates self, overflowing if this is equal to the minimum value.
See i64::overflowing_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i64)?;
let neg_five = NonZero::new(-5i64)?;
let min = NonZero::new(i64::MIN)?;
assert_eq!(pos_five.overflowing_neg(), (neg_five, false));
assert_eq!(min.overflowing_neg(), (min, true));1.71.0 (const: 1.71.0) ยท Sourcepub const fn saturating_neg(self) -> NonZero<i64>
pub const fn saturating_neg(self) -> NonZero<i64>
Saturating negation. Computes -self,
returning NonZero::<i64>::MAX
if self == NonZero::<i64>::MIN
instead of overflowing.
ยงExample
let pos_five = NonZero::new(5i64)?;
let neg_five = NonZero::new(-5i64)?;
let min = NonZero::new(i64::MIN)?;
let min_plus_one = NonZero::new(i64::MIN + 1)?;
let max = NonZero::new(i64::MAX)?;
assert_eq!(pos_five.saturating_neg(), neg_five);
assert_eq!(min.saturating_neg(), max);
assert_eq!(max.saturating_neg(), min_plus_one);1.71.0 (const: 1.71.0) ยท Sourcepub const fn wrapping_neg(self) -> NonZero<i64>
pub const fn wrapping_neg(self) -> NonZero<i64>
Wrapping (modular) negation. Computes -self, wrapping around at the boundary
of the type.
See i64::wrapping_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i64)?;
let neg_five = NonZero::new(-5i64)?;
let min = NonZero::new(i64::MIN)?;
assert_eq!(pos_five.wrapping_neg(), neg_five);
assert_eq!(min.wrapping_neg(), min);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_unsigned(self) -> NonZero<u64>
pub const fn cast_unsigned(self) -> NonZero<u64>
Returns the bit pattern of self reinterpreted as an unsigned integer of the same size.
ยงExamples
let n = NonZero::new(-1i64).unwrap();
assert_eq!(n.cast_unsigned(), NonZero::<u64>::MAX);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<i64>) -> Option<NonZero<i64>>
pub const fn checked_mul(self, other: NonZero<i64>) -> Option<NonZero<i64>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2i64)?;
let four = NonZero::new(4i64)?;
let max = NonZero::new(i64::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<i64>) -> NonZero<i64>
pub const fn saturating_mul(self, other: NonZero<i64>) -> NonZero<i64>
Multiplies two non-zero integers together.
Return NonZero::<i64>::MAX on overflow.
ยงExamples
let two = NonZero::new(2i64)?;
let four = NonZero::new(4i64)?;
let max = NonZero::new(i64::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<i64>) -> NonZero<i64>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<i64>) -> NonZero<i64>
nonzero_ops)Multiplies 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, or self * rhs < i64::MIN.
ยงExamples
#![feature(nonzero_ops)]
let two = NonZero::new(2i64)?;
let four = NonZero::new(4i64)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<i64>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<i64>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3i64)?;
let twenty_seven = NonZero::new(27i64)?;
let half_max = NonZero::new(i64::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<i64>
pub const fn saturating_pow(self, other: u32) -> NonZero<i64>
Raise non-zero value to an integer power.
Return NonZero::<i64>::MIN or NonZero::<i64>::MAX on overflow.
ยงExamples
let three = NonZero::new(3i64)?;
let twenty_seven = NonZero::new(27i64)?;
let max = NonZero::new(i64::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<i128>
impl NonZero<i128>
1.67.0 ยท Sourcepub const BITS: u32 = 128u32
pub const BITS: u32 = 128u32
The size of this non-zero integer type in bits.
This value is equal to i128::BITS.
ยงExamples
assert_eq!(NonZero::<i128>::BITS, i128::BITS);1.70.0 ยท Sourcepub const MIN: NonZero<i128>
pub const MIN: NonZero<i128>
The smallest value that can be represented by this non-zero
integer type,
equal to i128::MIN.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i128>::MIN.get(), i128::MIN);1.70.0 ยท Sourcepub const MAX: NonZero<i128>
pub const MAX: NonZero<i128>
The largest value that can be represented by this non-zero
integer type,
equal to i128::MAX.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<i128>::MAX.get(), i128::MAX);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<i128>::new(-1i128)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<i128>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<i128>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i128>::new(0b_01100100)?;
let b = NonZero::<i128>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<i128>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<i128>::new(0b_01100100)?;
let b = NonZero::<i128>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i128>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<i128>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<i128>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<i128>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<i128>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<i128>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<i128>::new(0b100_0000)?;
let b = NonZero::<i128>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<i128>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x13f40000000000000000000000004f76i128)?;
let m = NonZero::new(0x4f7613f4)?;
assert_eq!(n.rotate_left(16), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<i128>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x4f7613f4i128)?;
let m = NonZero::new(0x13f40000000000000000000000004f76)?;
assert_eq!(n.rotate_right(16), m);Sourcepub const fn swap_bytes(self) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<i128>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12345678901234567890123456789012i128)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x12907856341290785634129078563412)?);Sourcepub const fn reverse_bits(self) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<i128>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x12345678901234567890123456789012i128)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x48091e6a2c48091e6a2c48091e6a2c48)?);Sourcepub const fn from_be(x: NonZero<i128>) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<i128>) -> NonZero<i128>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI128;
let n = NonZero::new(0x1Ai128)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroI128::from_be(n), n)
} else {
assert_eq!(NonZeroI128::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<i128>) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<i128>) -> NonZero<i128>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroI128;
let n = NonZero::new(0x1Ai128)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroI128::from_le(n), n)
} else {
assert_eq!(NonZeroI128::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<i128>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai128)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<i128>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Ai128)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_abs(self) -> Option<NonZero<i128>>
pub const fn checked_abs(self) -> Option<NonZero<i128>>
Checked absolute value.
Checks for overflow and returns None if
self == NonZero::<i128>::MIN.
The result cannot be zero.
ยงExample
let pos = NonZero::new(1i128)?;
let neg = NonZero::new(-1i128)?;
let min = NonZero::new(i128::MIN)?;
assert_eq!(Some(pos), neg.checked_abs());
assert_eq!(None, min.checked_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn overflowing_abs(self) -> (NonZero<i128>, bool)
pub const fn overflowing_abs(self) -> (NonZero<i128>, bool)
Computes the absolute value of self,
with overflow information, see
i128::overflowing_abs.
ยงExample
let pos = NonZero::new(1i128)?;
let neg = NonZero::new(-1i128)?;
let min = NonZero::new(i128::MIN)?;
assert_eq!((pos, false), pos.overflowing_abs());
assert_eq!((pos, false), neg.overflowing_abs());
assert_eq!((min, true), min.overflowing_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_abs(self) -> NonZero<i128>
pub const fn saturating_abs(self) -> NonZero<i128>
Saturating absolute value, see
i128::saturating_abs.
ยงExample
let pos = NonZero::new(1i128)?;
let neg = NonZero::new(-1i128)?;
let min = NonZero::new(i128::MIN)?;
let min_plus = NonZero::new(i128::MIN + 1)?;
let max = NonZero::new(i128::MAX)?;
assert_eq!(pos, pos.saturating_abs());
assert_eq!(pos, neg.saturating_abs());
assert_eq!(max, min.saturating_abs());
assert_eq!(max, min_plus.saturating_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn wrapping_abs(self) -> NonZero<i128>
pub const fn wrapping_abs(self) -> NonZero<i128>
Wrapping absolute value, see
i128::wrapping_abs.
ยงExample
let pos = NonZero::new(1i128)?;
let neg = NonZero::new(-1i128)?;
let min = NonZero::new(i128::MIN)?;
assert_eq!(pos, pos.wrapping_abs());
assert_eq!(pos, neg.wrapping_abs());
assert_eq!(min, min.wrapping_abs());
assert_eq!(max, (-max).wrapping_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn unsigned_abs(self) -> NonZero<u128>
pub const fn unsigned_abs(self) -> NonZero<u128>
Computes the absolute value of self without any wrapping or panicking.
ยงExample
let u_pos = NonZero::new(1u128)?;
let i_pos = NonZero::new(1i128)?;
let i_neg = NonZero::new(-1i128)?;
let i_min = NonZero::new(i128::MIN)?;
let u_max = NonZero::new(u128::MAX / 2 + 1)?;
assert_eq!(u_pos, i_pos.unsigned_abs());
assert_eq!(u_pos, i_neg.unsigned_abs());
assert_eq!(u_max, i_min.unsigned_abs());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Returns true if self is positive and false if the
number is negative.
ยงExample
let pos_five = NonZero::new(5i128)?;
let neg_five = NonZero::new(-5i128)?;
assert!(pos_five.is_positive());
assert!(!neg_five.is_positive());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Returns true if self is negative and false if the
number is positive.
ยงExample
let pos_five = NonZero::new(5i128)?;
let neg_five = NonZero::new(-5i128)?;
assert!(neg_five.is_negative());
assert!(!pos_five.is_negative());1.71.0 (const: 1.71.0) ยท Sourcepub const fn checked_neg(self) -> Option<NonZero<i128>>
pub const fn checked_neg(self) -> Option<NonZero<i128>>
Checked negation. Computes -self,
returning None if self == NonZero::<i128>::MIN.
ยงExample
let pos_five = NonZero::new(5i128)?;
let neg_five = NonZero::new(-5i128)?;
let min = NonZero::new(i128::MIN)?;
assert_eq!(pos_five.checked_neg(), Some(neg_five));
assert_eq!(min.checked_neg(), None);1.71.0 (const: 1.71.0) ยท Sourcepub const fn overflowing_neg(self) -> (NonZero<i128>, bool)
pub const fn overflowing_neg(self) -> (NonZero<i128>, bool)
Negates self, overflowing if this is equal to the minimum value.
See i128::overflowing_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i128)?;
let neg_five = NonZero::new(-5i128)?;
let min = NonZero::new(i128::MIN)?;
assert_eq!(pos_five.overflowing_neg(), (neg_five, false));
assert_eq!(min.overflowing_neg(), (min, true));1.71.0 (const: 1.71.0) ยท Sourcepub const fn saturating_neg(self) -> NonZero<i128>
pub const fn saturating_neg(self) -> NonZero<i128>
Saturating negation. Computes -self,
returning NonZero::<i128>::MAX
if self == NonZero::<i128>::MIN
instead of overflowing.
ยงExample
let pos_five = NonZero::new(5i128)?;
let neg_five = NonZero::new(-5i128)?;
let min = NonZero::new(i128::MIN)?;
let min_plus_one = NonZero::new(i128::MIN + 1)?;
let max = NonZero::new(i128::MAX)?;
assert_eq!(pos_five.saturating_neg(), neg_five);
assert_eq!(min.saturating_neg(), max);
assert_eq!(max.saturating_neg(), min_plus_one);1.71.0 (const: 1.71.0) ยท Sourcepub const fn wrapping_neg(self) -> NonZero<i128>
pub const fn wrapping_neg(self) -> NonZero<i128>
Wrapping (modular) negation. Computes -self, wrapping around at the boundary
of the type.
See i128::wrapping_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5i128)?;
let neg_five = NonZero::new(-5i128)?;
let min = NonZero::new(i128::MIN)?;
assert_eq!(pos_five.wrapping_neg(), neg_five);
assert_eq!(min.wrapping_neg(), min);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_unsigned(self) -> NonZero<u128>
pub const fn cast_unsigned(self) -> NonZero<u128>
Returns the bit pattern of self reinterpreted as an unsigned integer of the same size.
ยงExamples
let n = NonZero::new(-1i128).unwrap();
assert_eq!(n.cast_unsigned(), NonZero::<u128>::MAX);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<i128>) -> Option<NonZero<i128>>
pub const fn checked_mul(self, other: NonZero<i128>) -> Option<NonZero<i128>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2i128)?;
let four = NonZero::new(4i128)?;
let max = NonZero::new(i128::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<i128>) -> NonZero<i128>
pub const fn saturating_mul(self, other: NonZero<i128>) -> NonZero<i128>
Multiplies two non-zero integers together.
Return NonZero::<i128>::MAX on overflow.
ยงExamples
let two = NonZero::new(2i128)?;
let four = NonZero::new(4i128)?;
let max = NonZero::new(i128::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<i128>) -> NonZero<i128>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<i128>) -> NonZero<i128>
nonzero_ops)Multiplies 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, or self * rhs < i128::MIN.
ยงExamples
#![feature(nonzero_ops)]
let two = NonZero::new(2i128)?;
let four = NonZero::new(4i128)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<i128>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<i128>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3i128)?;
let twenty_seven = NonZero::new(27i128)?;
let half_max = NonZero::new(i128::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<i128>
pub const fn saturating_pow(self, other: u32) -> NonZero<i128>
Raise non-zero value to an integer power.
Return NonZero::<i128>::MIN or NonZero::<i128>::MAX on overflow.
ยงExamples
let three = NonZero::new(3i128)?;
let twenty_seven = NonZero::new(27i128)?;
let max = NonZero::new(i128::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Sourceยงimpl NonZero<isize>
impl NonZero<isize>
1.67.0 ยท Sourcepub const BITS: u32 = 64u32
pub const BITS: u32 = 64u32
The size of this non-zero integer type in bits.
This value is equal to isize::BITS.
ยงExamples
assert_eq!(NonZero::<isize>::BITS, isize::BITS);1.70.0 ยท Sourcepub const MIN: NonZero<isize>
pub const MIN: NonZero<isize>
The smallest value that can be represented by this non-zero
integer type,
equal to isize::MIN.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<isize>::MIN.get(), isize::MIN);1.70.0 ยท Sourcepub const MAX: NonZero<isize>
pub const MAX: NonZero<isize>
The largest value that can be represented by this non-zero
integer type,
equal to isize::MAX.
Note: While most integer types are defined for every whole
number between MIN and MAX, signed non-zero integers are
a special case. They have a โgapโ at 0.
ยงExamples
assert_eq!(NonZero::<isize>::MAX.get(), isize::MAX);1.53.0 (const: 1.53.0) ยท Sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns 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
let n = NonZero::<isize>::new(-1isize)?;
assert_eq!(n.leading_zeros(), 0);1.53.0 (const: 1.53.0) ยท Sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns 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
let n = NonZero::<isize>::new(0b0101000)?;
assert_eq!(n.trailing_zeros(), 3);Sourcepub const fn isolate_highest_one(self) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_highest_one(self) -> NonZero<isize>
isolate_most_least_significant_one)Returns self with only the most significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<isize>::new(0b_01100100)?;
let b = NonZero::<isize>::new(0b_01000000)?;
assert_eq!(a.isolate_highest_one(), b);Sourcepub const fn isolate_lowest_one(self) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (isolate_most_least_significant_one)
pub const fn isolate_lowest_one(self) -> NonZero<isize>
isolate_most_least_significant_one)Returns self with only the least significant bit set.
ยงExample
#![feature(isolate_most_least_significant_one)]
let a = NonZero::<isize>::new(0b_01100100)?;
let b = NonZero::<isize>::new(0b_00000100)?;
assert_eq!(a.isolate_lowest_one(), b);Sourcepub const fn highest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn highest_one(self) -> u32
int_lowest_highest_one)Returns the index of the highest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<isize>::new(0b1)?.highest_one(), 0);
assert_eq!(NonZero::<isize>::new(0b1_0000)?.highest_one(), 4);
assert_eq!(NonZero::<isize>::new(0b1_1111)?.highest_one(), 4);Sourcepub const fn lowest_one(self) -> u32
๐ฌThis is a nightly-only experimental API. (int_lowest_highest_one)
pub const fn lowest_one(self) -> u32
int_lowest_highest_one)Returns the index of the lowest bit set to one in self.
ยงExamples
#![feature(int_lowest_highest_one)]
assert_eq!(NonZero::<isize>::new(0b1)?.lowest_one(), 0);
assert_eq!(NonZero::<isize>::new(0b1_0000)?.lowest_one(), 4);
assert_eq!(NonZero::<isize>::new(0b1_1111)?.lowest_one(), 0);1.86.0 (const: 1.86.0) ยท Sourcepub const fn count_ones(self) -> NonZero<u32>
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
ยงExamples
let a = NonZero::<isize>::new(0b100_0000)?;
let b = NonZero::<isize>::new(0b100_0011)?;
assert_eq!(a.count_ones(), NonZero::new(1)?);
assert_eq!(b.count_ones(), NonZero::new(3)?);Sourcepub const fn rotate_left(self, n: u32) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_left(self, n: u32) -> NonZero<isize>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0xaa00000000006e1isize)?;
let m = NonZero::new(0x6e10aa)?;
assert_eq!(n.rotate_left(12), m);Sourcepub const fn rotate_right(self, n: u32) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn rotate_right(self, n: u32) -> NonZero<isize>
nonzero_bitwise)Shifts 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x6e10aaisize)?;
let m = NonZero::new(0xaa00000000006e1)?;
assert_eq!(n.rotate_right(12), m);Sourcepub const fn swap_bytes(self) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn swap_bytes(self) -> NonZero<isize>
nonzero_bitwise)Reverses the byte order of the integer.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234567890123456isize)?;
let m = n.swap_bytes();
assert_eq!(m, NonZero::new(0x5634129078563412)?);Sourcepub const fn reverse_bits(self) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn reverse_bits(self) -> NonZero<isize>
nonzero_bitwise)Reverses 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
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1234567890123456isize)?;
let m = n.reverse_bits();
assert_eq!(m, NonZero::new(0x6a2c48091e6a2c48)?);Sourcepub const fn from_be(x: NonZero<isize>) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_be(x: NonZero<isize>) -> NonZero<isize>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroIsize;
let n = NonZero::new(0x1Aisize)?;
if cfg!(target_endian = "big") {
assert_eq!(NonZeroIsize::from_be(n), n)
} else {
assert_eq!(NonZeroIsize::from_be(n), n.swap_bytes())
}Sourcepub const fn from_le(x: NonZero<isize>) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn from_le(x: NonZero<isize>) -> NonZero<isize>
nonzero_bitwise)Converts 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
#![feature(nonzero_bitwise)]
use std::num::NonZeroIsize;
let n = NonZero::new(0x1Aisize)?;
if cfg!(target_endian = "little") {
assert_eq!(NonZeroIsize::from_le(n), n)
} else {
assert_eq!(NonZeroIsize::from_le(n), n.swap_bytes())
}Sourcepub const fn to_be(self) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_be(self) -> NonZero<isize>
nonzero_bitwise)Converts self to big endian from the targetโs endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Aisize)?;
if cfg!(target_endian = "big") {
assert_eq!(n.to_be(), n)
} else {
assert_eq!(n.to_be(), n.swap_bytes())
}Sourcepub const fn to_le(self) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_bitwise)
pub const fn to_le(self) -> NonZero<isize>
nonzero_bitwise)Converts self to little endian from the targetโs endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
ยงExamples
#![feature(nonzero_bitwise)]
let n = NonZero::new(0x1Aisize)?;
if cfg!(target_endian = "little") {
assert_eq!(n.to_le(), n)
} else {
assert_eq!(n.to_le(), n.swap_bytes())
}1.64.0 (const: 1.64.0) ยท Sourcepub const fn abs(self) -> NonZero<isize>
pub const fn abs(self) -> NonZero<isize>
Computes the absolute value of self.
See isize::abs
for documentation on overflow behavior.
ยงExample
let pos = NonZero::new(1isize)?;
let neg = NonZero::new(-1isize)?;
assert_eq!(pos, pos.abs());
assert_eq!(pos, neg.abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_abs(self) -> Option<NonZero<isize>>
pub const fn checked_abs(self) -> Option<NonZero<isize>>
Checked absolute value.
Checks for overflow and returns None if
self == NonZero::<isize>::MIN.
The result cannot be zero.
ยงExample
let pos = NonZero::new(1isize)?;
let neg = NonZero::new(-1isize)?;
let min = NonZero::new(isize::MIN)?;
assert_eq!(Some(pos), neg.checked_abs());
assert_eq!(None, min.checked_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn overflowing_abs(self) -> (NonZero<isize>, bool)
pub const fn overflowing_abs(self) -> (NonZero<isize>, bool)
Computes the absolute value of self,
with overflow information, see
isize::overflowing_abs.
ยงExample
let pos = NonZero::new(1isize)?;
let neg = NonZero::new(-1isize)?;
let min = NonZero::new(isize::MIN)?;
assert_eq!((pos, false), pos.overflowing_abs());
assert_eq!((pos, false), neg.overflowing_abs());
assert_eq!((min, true), min.overflowing_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_abs(self) -> NonZero<isize>
pub const fn saturating_abs(self) -> NonZero<isize>
Saturating absolute value, see
isize::saturating_abs.
ยงExample
let pos = NonZero::new(1isize)?;
let neg = NonZero::new(-1isize)?;
let min = NonZero::new(isize::MIN)?;
let min_plus = NonZero::new(isize::MIN + 1)?;
let max = NonZero::new(isize::MAX)?;
assert_eq!(pos, pos.saturating_abs());
assert_eq!(pos, neg.saturating_abs());
assert_eq!(max, min.saturating_abs());
assert_eq!(max, min_plus.saturating_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn wrapping_abs(self) -> NonZero<isize>
pub const fn wrapping_abs(self) -> NonZero<isize>
Wrapping absolute value, see
isize::wrapping_abs.
ยงExample
let pos = NonZero::new(1isize)?;
let neg = NonZero::new(-1isize)?;
let min = NonZero::new(isize::MIN)?;
assert_eq!(pos, pos.wrapping_abs());
assert_eq!(pos, neg.wrapping_abs());
assert_eq!(min, min.wrapping_abs());
assert_eq!(max, (-max).wrapping_abs());1.64.0 (const: 1.64.0) ยท Sourcepub const fn unsigned_abs(self) -> NonZero<usize>
pub const fn unsigned_abs(self) -> NonZero<usize>
Computes the absolute value of self without any wrapping or panicking.
ยงExample
let u_pos = NonZero::new(1usize)?;
let i_pos = NonZero::new(1isize)?;
let i_neg = NonZero::new(-1isize)?;
let i_min = NonZero::new(isize::MIN)?;
let u_max = NonZero::new(usize::MAX / 2 + 1)?;
assert_eq!(u_pos, i_pos.unsigned_abs());
assert_eq!(u_pos, i_neg.unsigned_abs());
assert_eq!(u_max, i_min.unsigned_abs());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
Returns true if self is positive and false if the
number is negative.
ยงExample
let pos_five = NonZero::new(5isize)?;
let neg_five = NonZero::new(-5isize)?;
assert!(pos_five.is_positive());
assert!(!neg_five.is_positive());1.71.0 (const: 1.71.0) ยท Sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
Returns true if self is negative and false if the
number is positive.
ยงExample
let pos_five = NonZero::new(5isize)?;
let neg_five = NonZero::new(-5isize)?;
assert!(neg_five.is_negative());
assert!(!pos_five.is_negative());1.71.0 (const: 1.71.0) ยท Sourcepub const fn checked_neg(self) -> Option<NonZero<isize>>
pub const fn checked_neg(self) -> Option<NonZero<isize>>
Checked negation. Computes -self,
returning None if self == NonZero::<isize>::MIN.
ยงExample
let pos_five = NonZero::new(5isize)?;
let neg_five = NonZero::new(-5isize)?;
let min = NonZero::new(isize::MIN)?;
assert_eq!(pos_five.checked_neg(), Some(neg_five));
assert_eq!(min.checked_neg(), None);1.71.0 (const: 1.71.0) ยท Sourcepub const fn overflowing_neg(self) -> (NonZero<isize>, bool)
pub const fn overflowing_neg(self) -> (NonZero<isize>, bool)
Negates self, overflowing if this is equal to the minimum value.
See isize::overflowing_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5isize)?;
let neg_five = NonZero::new(-5isize)?;
let min = NonZero::new(isize::MIN)?;
assert_eq!(pos_five.overflowing_neg(), (neg_five, false));
assert_eq!(min.overflowing_neg(), (min, true));1.71.0 (const: 1.71.0) ยท Sourcepub const fn saturating_neg(self) -> NonZero<isize>
pub const fn saturating_neg(self) -> NonZero<isize>
Saturating negation. Computes -self,
returning NonZero::<isize>::MAX
if self == NonZero::<isize>::MIN
instead of overflowing.
ยงExample
let pos_five = NonZero::new(5isize)?;
let neg_five = NonZero::new(-5isize)?;
let min = NonZero::new(isize::MIN)?;
let min_plus_one = NonZero::new(isize::MIN + 1)?;
let max = NonZero::new(isize::MAX)?;
assert_eq!(pos_five.saturating_neg(), neg_five);
assert_eq!(min.saturating_neg(), max);
assert_eq!(max.saturating_neg(), min_plus_one);1.71.0 (const: 1.71.0) ยท Sourcepub const fn wrapping_neg(self) -> NonZero<isize>
pub const fn wrapping_neg(self) -> NonZero<isize>
Wrapping (modular) negation. Computes -self, wrapping around at the boundary
of the type.
See isize::wrapping_neg
for documentation on overflow behavior.
ยงExample
let pos_five = NonZero::new(5isize)?;
let neg_five = NonZero::new(-5isize)?;
let min = NonZero::new(isize::MIN)?;
assert_eq!(pos_five.wrapping_neg(), neg_five);
assert_eq!(min.wrapping_neg(), min);1.87.0 (const: 1.87.0) ยท Sourcepub const fn cast_unsigned(self) -> NonZero<usize>
pub const fn cast_unsigned(self) -> NonZero<usize>
Returns the bit pattern of self reinterpreted as an unsigned integer of the same size.
ยงExamples
let n = NonZero::new(-1isize).unwrap();
assert_eq!(n.cast_unsigned(), NonZero::<usize>::MAX);1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_mul(self, other: NonZero<isize>) -> Option<NonZero<isize>>
pub const fn checked_mul(self, other: NonZero<isize>) -> Option<NonZero<isize>>
Multiplies two non-zero integers together.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let two = NonZero::new(2isize)?;
let four = NonZero::new(4isize)?;
let max = NonZero::new(isize::MAX)?;
assert_eq!(Some(four), two.checked_mul(two));
assert_eq!(None, max.checked_mul(two));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_mul(self, other: NonZero<isize>) -> NonZero<isize>
pub const fn saturating_mul(self, other: NonZero<isize>) -> NonZero<isize>
Multiplies two non-zero integers together.
Return NonZero::<isize>::MAX on overflow.
ยงExamples
let two = NonZero::new(2isize)?;
let four = NonZero::new(4isize)?;
let max = NonZero::new(isize::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));Sourcepub const unsafe fn unchecked_mul(self, other: NonZero<isize>) -> NonZero<isize>
๐ฌThis is a nightly-only experimental API. (nonzero_ops)
pub const unsafe fn unchecked_mul(self, other: NonZero<isize>) -> NonZero<isize>
nonzero_ops)Multiplies 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, or self * rhs < isize::MIN.
ยงExamples
#![feature(nonzero_ops)]
let two = NonZero::new(2isize)?;
let four = NonZero::new(4isize)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });1.64.0 (const: 1.64.0) ยท Sourcepub const fn checked_pow(self, other: u32) -> Option<NonZero<isize>>
pub const fn checked_pow(self, other: u32) -> Option<NonZero<isize>>
Raises non-zero value to an integer power.
Checks for overflow and returns None on overflow.
As a consequence, the result cannot wrap to zero.
ยงExamples
let three = NonZero::new(3isize)?;
let twenty_seven = NonZero::new(27isize)?;
let half_max = NonZero::new(isize::MAX / 2)?;
assert_eq!(Some(twenty_seven), three.checked_pow(3));
assert_eq!(None, half_max.checked_pow(3));1.64.0 (const: 1.64.0) ยท Sourcepub const fn saturating_pow(self, other: u32) -> NonZero<isize>
pub const fn saturating_pow(self, other: u32) -> NonZero<isize>
Raise non-zero value to an integer power.
Return NonZero::<isize>::MIN or NonZero::<isize>::MAX on overflow.
ยงExamples
let three = NonZero::new(3isize)?;
let twenty_seven = NonZero::new(27isize)?;
let max = NonZero::new(isize::MAX)?;
assert_eq!(twenty_seven, three.saturating_pow(3));
assert_eq!(max, max.saturating_pow(3));Trait Implementationsยง
ยงimpl<'a> AddAnyAttr for NonZero<i128>
impl<'a> AddAnyAttr for NonZero<i128>
ยงtype Output<SomeNewAttr: Attribute> = NonZero<i128>
type Output<SomeNewAttr: Attribute> = NonZero<i128>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i128> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i128> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<i16>
impl<'a> AddAnyAttr for NonZero<i16>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i16> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i16> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<i32>
impl<'a> AddAnyAttr for NonZero<i32>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i32> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i32> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<i64>
impl<'a> AddAnyAttr for NonZero<i64>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i64> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i64> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<i8>
impl<'a> AddAnyAttr for NonZero<i8>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i8> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<i8> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<isize>
impl<'a> AddAnyAttr for NonZero<isize>
ยงtype Output<SomeNewAttr: Attribute> = NonZero<isize>
type Output<SomeNewAttr: Attribute> = NonZero<isize>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<isize> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<isize> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<u128>
impl<'a> AddAnyAttr for NonZero<u128>
ยงtype Output<SomeNewAttr: Attribute> = NonZero<u128>
type Output<SomeNewAttr: Attribute> = NonZero<u128>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u128> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u128> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<u16>
impl<'a> AddAnyAttr for NonZero<u16>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u16> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u16> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<u32>
impl<'a> AddAnyAttr for NonZero<u32>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u32> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u32> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<u64>
impl<'a> AddAnyAttr for NonZero<u64>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u64> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u64> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<u8>
impl<'a> AddAnyAttr for NonZero<u8>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u8> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<u8> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl<'a> AddAnyAttr for NonZero<usize>
impl<'a> AddAnyAttr for NonZero<usize>
ยงtype Output<SomeNewAttr: Attribute> = NonZero<usize>
type Output<SomeNewAttr: Attribute> = NonZero<usize>
ยงfn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<usize> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
fn add_any_attr<NewAttr>(
self,
_attr: NewAttr,
) -> <NonZero<usize> as AddAnyAttr>::Output<NewAttr>where
NewAttr: Attribute,
ยงimpl AttributeValue for NonZero<i128>
impl AttributeValue for NonZero<i128>
ยงtype AsyncOutput = NonZero<i128>
type AsyncOutput = NonZero<i128>
ยงtype State = (Element, NonZero<i128>)
type State = (Element, NonZero<i128>)
ยงtype Cloneable = NonZero<i128>
type Cloneable = NonZero<i128>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<i128>
type CloneableOwned = NonZero<i128>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<i128> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<i128> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<i128> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<i128> as AttributeValue>::State
ยงfn rebuild(
self,
key: &str,
state: &mut <NonZero<i128> as AttributeValue>::State,
)
fn rebuild( self, key: &str, state: &mut <NonZero<i128> as AttributeValue>::State, )
ยงfn into_cloneable(self) -> <NonZero<i128> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<i128> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<i128> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<i128> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<i16>
impl AttributeValue for NonZero<i16>
ยงtype AsyncOutput = NonZero<i16>
type AsyncOutput = NonZero<i16>
ยงtype State = (Element, NonZero<i16>)
type State = (Element, NonZero<i16>)
ยงtype Cloneable = NonZero<i16>
type Cloneable = NonZero<i16>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<i16>
type CloneableOwned = NonZero<i16>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<i16> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<i16> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<i16> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<i16> as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <NonZero<i16> as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <NonZero<i16> as AttributeValue>::State)
ยงfn into_cloneable(self) -> <NonZero<i16> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<i16> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<i16> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<i16> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<i32>
impl AttributeValue for NonZero<i32>
ยงtype AsyncOutput = NonZero<i32>
type AsyncOutput = NonZero<i32>
ยงtype State = (Element, NonZero<i32>)
type State = (Element, NonZero<i32>)
ยงtype Cloneable = NonZero<i32>
type Cloneable = NonZero<i32>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<i32>
type CloneableOwned = NonZero<i32>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<i32> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<i32> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<i32> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<i32> as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <NonZero<i32> as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <NonZero<i32> as AttributeValue>::State)
ยงfn into_cloneable(self) -> <NonZero<i32> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<i32> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<i32> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<i32> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<i64>
impl AttributeValue for NonZero<i64>
ยงtype AsyncOutput = NonZero<i64>
type AsyncOutput = NonZero<i64>
ยงtype State = (Element, NonZero<i64>)
type State = (Element, NonZero<i64>)
ยงtype Cloneable = NonZero<i64>
type Cloneable = NonZero<i64>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<i64>
type CloneableOwned = NonZero<i64>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<i64> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<i64> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<i64> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<i64> as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <NonZero<i64> as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <NonZero<i64> as AttributeValue>::State)
ยงfn into_cloneable(self) -> <NonZero<i64> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<i64> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<i64> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<i64> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<i8>
impl AttributeValue for NonZero<i8>
ยงtype AsyncOutput = NonZero<i8>
type AsyncOutput = NonZero<i8>
ยงtype State = (Element, NonZero<i8>)
type State = (Element, NonZero<i8>)
ยงtype Cloneable = NonZero<i8>
type Cloneable = NonZero<i8>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<i8>
type CloneableOwned = NonZero<i8>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<i8> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<i8> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<i8> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<i8> as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <NonZero<i8> as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <NonZero<i8> as AttributeValue>::State)
ยงfn into_cloneable(self) -> <NonZero<i8> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<i8> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(self) -> <NonZero<i8> as AttributeValue>::CloneableOwned
fn into_cloneable_owned(self) -> <NonZero<i8> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<isize>
impl AttributeValue for NonZero<isize>
ยงtype AsyncOutput = NonZero<isize>
type AsyncOutput = NonZero<isize>
ยงtype State = (Element, NonZero<isize>)
type State = (Element, NonZero<isize>)
ยงtype Cloneable = NonZero<isize>
type Cloneable = NonZero<isize>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<isize>
type CloneableOwned = NonZero<isize>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<isize> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<isize> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<isize> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<isize> as AttributeValue>::State
ยงfn rebuild(
self,
key: &str,
state: &mut <NonZero<isize> as AttributeValue>::State,
)
fn rebuild( self, key: &str, state: &mut <NonZero<isize> as AttributeValue>::State, )
ยงfn into_cloneable(self) -> <NonZero<isize> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<isize> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<isize> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<isize> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<u128>
impl AttributeValue for NonZero<u128>
ยงtype AsyncOutput = NonZero<u128>
type AsyncOutput = NonZero<u128>
ยงtype State = (Element, NonZero<u128>)
type State = (Element, NonZero<u128>)
ยงtype Cloneable = NonZero<u128>
type Cloneable = NonZero<u128>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<u128>
type CloneableOwned = NonZero<u128>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<u128> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<u128> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<u128> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<u128> as AttributeValue>::State
ยงfn rebuild(
self,
key: &str,
state: &mut <NonZero<u128> as AttributeValue>::State,
)
fn rebuild( self, key: &str, state: &mut <NonZero<u128> as AttributeValue>::State, )
ยงfn into_cloneable(self) -> <NonZero<u128> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<u128> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<u128> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<u128> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<u16>
impl AttributeValue for NonZero<u16>
ยงtype AsyncOutput = NonZero<u16>
type AsyncOutput = NonZero<u16>
ยงtype State = (Element, NonZero<u16>)
type State = (Element, NonZero<u16>)
ยงtype Cloneable = NonZero<u16>
type Cloneable = NonZero<u16>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<u16>
type CloneableOwned = NonZero<u16>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<u16> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<u16> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<u16> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<u16> as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <NonZero<u16> as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <NonZero<u16> as AttributeValue>::State)
ยงfn into_cloneable(self) -> <NonZero<u16> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<u16> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<u16> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<u16> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<u32>
impl AttributeValue for NonZero<u32>
ยงtype AsyncOutput = NonZero<u32>
type AsyncOutput = NonZero<u32>
ยงtype State = (Element, NonZero<u32>)
type State = (Element, NonZero<u32>)
ยงtype Cloneable = NonZero<u32>
type Cloneable = NonZero<u32>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<u32>
type CloneableOwned = NonZero<u32>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<u32> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<u32> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<u32> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<u32> as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <NonZero<u32> as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <NonZero<u32> as AttributeValue>::State)
ยงfn into_cloneable(self) -> <NonZero<u32> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<u32> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<u32> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<u32> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<u64>
impl AttributeValue for NonZero<u64>
ยงtype AsyncOutput = NonZero<u64>
type AsyncOutput = NonZero<u64>
ยงtype State = (Element, NonZero<u64>)
type State = (Element, NonZero<u64>)
ยงtype Cloneable = NonZero<u64>
type Cloneable = NonZero<u64>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<u64>
type CloneableOwned = NonZero<u64>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<u64> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<u64> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<u64> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<u64> as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <NonZero<u64> as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <NonZero<u64> as AttributeValue>::State)
ยงfn into_cloneable(self) -> <NonZero<u64> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<u64> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<u64> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<u64> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<u8>
impl AttributeValue for NonZero<u8>
ยงtype AsyncOutput = NonZero<u8>
type AsyncOutput = NonZero<u8>
ยงtype State = (Element, NonZero<u8>)
type State = (Element, NonZero<u8>)
ยงtype Cloneable = NonZero<u8>
type Cloneable = NonZero<u8>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<u8>
type CloneableOwned = NonZero<u8>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<u8> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<u8> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<u8> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<u8> as AttributeValue>::State
ยงfn rebuild(self, key: &str, state: &mut <NonZero<u8> as AttributeValue>::State)
fn rebuild(self, key: &str, state: &mut <NonZero<u8> as AttributeValue>::State)
ยงfn into_cloneable(self) -> <NonZero<u8> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<u8> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(self) -> <NonZero<u8> as AttributeValue>::CloneableOwned
fn into_cloneable_owned(self) -> <NonZero<u8> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงimpl AttributeValue for NonZero<usize>
impl AttributeValue for NonZero<usize>
ยงtype AsyncOutput = NonZero<usize>
type AsyncOutput = NonZero<usize>
ยงtype State = (Element, NonZero<usize>)
type State = (Element, NonZero<usize>)
ยงtype Cloneable = NonZero<usize>
type Cloneable = NonZero<usize>
FnMut() continues mutating the same
closure), but making a String cloneable does not necessarily need to make it an
Arc<str>, as two different clones of a String will still have the same value.ยงtype CloneableOwned = NonZero<usize>
type CloneableOwned = NonZero<usize>
'static. This is used for spreading across types when the
spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned
cloneable type has worse performance than the cloneable type, so they are separate.ยงfn to_template(_key: &str, _buf: &mut String)
fn to_template(_key: &str, _buf: &mut String)
<template>.ยงfn hydrate<const FROM_SERVER: bool>(
self,
key: &str,
el: &Element,
) -> <NonZero<usize> as AttributeValue>::State
fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <NonZero<usize> as AttributeValue>::State
<template>.ยงfn build(
self,
el: &Element,
key: &str,
) -> <NonZero<usize> as AttributeValue>::State
fn build( self, el: &Element, key: &str, ) -> <NonZero<usize> as AttributeValue>::State
ยงfn rebuild(
self,
key: &str,
state: &mut <NonZero<usize> as AttributeValue>::State,
)
fn rebuild( self, key: &str, state: &mut <NonZero<usize> as AttributeValue>::State, )
ยงfn into_cloneable(self) -> <NonZero<usize> as AttributeValue>::Cloneable
fn into_cloneable(self) -> <NonZero<usize> as AttributeValue>::Cloneable
ยงfn into_cloneable_owned(
self,
) -> <NonZero<usize> as AttributeValue>::CloneableOwned
fn into_cloneable_owned( self, ) -> <NonZero<usize> as AttributeValue>::CloneableOwned
'static.ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
1.45.0 (const: unstable) ยท Sourceยงimpl<T> BitOr<NonZero<T>> for Twhere
T: ZeroablePrimitive + BitOr<Output = T>,
impl<T> BitOr<NonZero<T>> for Twhere
T: ZeroablePrimitive + BitOr<Output = T>,
1.45.0 (const: unstable) ยท Sourceยงimpl<T> BitOr<T> for NonZero<T>where
T: ZeroablePrimitive + BitOr<Output = T>,
impl<T> BitOr<T> for NonZero<T>where
T: ZeroablePrimitive + BitOr<Output = T>,
1.45.0 (const: unstable) ยท Sourceยงimpl<T> BitOr for NonZero<T>where
T: ZeroablePrimitive + BitOr<Output = T>,
impl<T> BitOr for NonZero<T>where
T: ZeroablePrimitive + BitOr<Output = T>,
1.45.0 (const: unstable) ยท Sourceยงimpl<T> BitOrAssign<T> for NonZero<T>
impl<T> BitOrAssign<T> for NonZero<T>
Sourceยงfn bitor_assign(&mut self, rhs: T)
fn bitor_assign(&mut self, rhs: T)
|= operation. Read more1.45.0 (const: unstable) ยท Sourceยงimpl<T> BitOrAssign for NonZero<T>
impl<T> BitOrAssign for NonZero<T>
Sourceยงfn bitor_assign(&mut self, rhs: NonZero<T>)
fn bitor_assign(&mut self, rhs: NonZero<T>)
|= operation. Read moreSourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i128>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i128>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i128>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i128>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i16>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i16>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i16>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i16>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i32>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i32>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i32>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i32>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i64>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i64>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i64>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i64>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i8>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<i8>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i8>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<i8>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<isize>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<isize>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<isize>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<isize>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u128>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u128>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u128>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u128>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u16>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u16>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u16>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u16>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u32>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u32>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u32>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u32>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u64>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u64>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u64>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u64>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u8>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<u8>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u8>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<u8>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
Sourceยงimpl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<usize>
impl<'de, __Context> BorrowDecode<'de, __Context> for NonZero<usize>
Sourceยงfn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<usize>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
fn borrow_decode<D>(decoder: &mut D) -> Result<NonZero<usize>, DecodeError>where
D: BorrowDecoder<'de, Context = __Context>,
1.28.0 ยท Sourceยงimpl<T> Clone for NonZero<T>where
T: ZeroablePrimitive,
impl<T> Clone for NonZero<T>where
T: ZeroablePrimitive,
ยงimpl DeepSizeOf for NonZero<i128>
impl DeepSizeOf for NonZero<i128>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<i16>
impl DeepSizeOf for NonZero<i16>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<i32>
impl DeepSizeOf for NonZero<i32>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<i64>
impl DeepSizeOf for NonZero<i64>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<i8>
impl DeepSizeOf for NonZero<i8>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<isize>
impl DeepSizeOf for NonZero<isize>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<u128>
impl DeepSizeOf for NonZero<u128>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<u16>
impl DeepSizeOf for NonZero<u16>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<u32>
impl DeepSizeOf for NonZero<u32>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<u64>
impl DeepSizeOf for NonZero<u64>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<u8>
impl DeepSizeOf for NonZero<u8>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
ยงimpl DeepSizeOf for NonZero<usize>
impl DeepSizeOf for NonZero<usize>
ยงfn deep_size_of_children(&self, _: &mut Context) -> usize
fn deep_size_of_children(&self, _: &mut Context) -> usize
ยงfn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
Sourceยงimpl<'de> Deserialize<'de> for NonZero<i128>
impl<'de> Deserialize<'de> for NonZero<i128>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i128>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i128>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<i16>
impl<'de> Deserialize<'de> for NonZero<i16>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i16>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i16>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<i32>
impl<'de> Deserialize<'de> for NonZero<i32>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i32>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i32>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<i64>
impl<'de> Deserialize<'de> for NonZero<i64>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i64>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i64>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<i8>
impl<'de> Deserialize<'de> for NonZero<i8>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i8>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<i8>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<isize>
impl<'de> Deserialize<'de> for NonZero<isize>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<isize>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<isize>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<u128>
impl<'de> Deserialize<'de> for NonZero<u128>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u128>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u128>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<u16>
impl<'de> Deserialize<'de> for NonZero<u16>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u16>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u16>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<u32>
impl<'de> Deserialize<'de> for NonZero<u32>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u32>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u32>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<u64>
impl<'de> Deserialize<'de> for NonZero<u64>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u64>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u64>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<u8>
impl<'de> Deserialize<'de> for NonZero<u8>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u8>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<u8>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Sourceยงimpl<'de> Deserialize<'de> for NonZero<usize>
impl<'de> Deserialize<'de> for NonZero<usize>
Sourceยงfn deserialize<D>(
deserializer: D,
) -> Result<NonZero<usize>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<NonZero<usize>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
1.51.0 (const: unstable) ยท Sourceยงimpl Div<NonZero<u128>> for u128
impl Div<NonZero<u128>> for u128
1.51.0 (const: unstable) ยท Sourceยงimpl Div<NonZero<u16>> for u16
impl Div<NonZero<u16>> for u16
1.51.0 (const: unstable) ยท Sourceยงimpl Div<NonZero<u32>> for u32
impl Div<NonZero<u32>> for u32
1.51.0 (const: unstable) ยท Sourceยงimpl Div<NonZero<u64>> for u64
impl Div<NonZero<u64>> for u64
1.51.0 (const: unstable) ยท Sourceยงimpl Div<NonZero<u8>> for u8
impl Div<NonZero<u8>> for u8
1.51.0 (const: unstable) ยท Sourceยงimpl Div<NonZero<usize>> for usize
impl Div<NonZero<usize>> for usize
1.79.0 (const: unstable) ยท Sourceยงimpl DivAssign<NonZero<u128>> for u128
impl DivAssign<NonZero<u128>> for u128
Sourceยงfn div_assign(&mut self, other: NonZero<u128>)
fn div_assign(&mut self, other: NonZero<u128>)
Same as self /= other.get(), but because other is a NonZero<_>,
thereโs never a runtime check for division-by-zero.
This operation rounds towards zero, truncating any fractional part of the exact result, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl DivAssign<NonZero<u16>> for u16
impl DivAssign<NonZero<u16>> for u16
Sourceยงfn div_assign(&mut self, other: NonZero<u16>)
fn div_assign(&mut self, other: NonZero<u16>)
Same as self /= other.get(), but because other is a NonZero<_>,
thereโs never a runtime check for division-by-zero.
This operation rounds towards zero, truncating any fractional part of the exact result, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl DivAssign<NonZero<u32>> for u32
impl DivAssign<NonZero<u32>> for u32
Sourceยงfn div_assign(&mut self, other: NonZero<u32>)
fn div_assign(&mut self, other: NonZero<u32>)
Same as self /= other.get(), but because other is a NonZero<_>,
thereโs never a runtime check for division-by-zero.
This operation rounds towards zero, truncating any fractional part of the exact result, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl DivAssign<NonZero<u64>> for u64
impl DivAssign<NonZero<u64>> for u64
Sourceยงfn div_assign(&mut self, other: NonZero<u64>)
fn div_assign(&mut self, other: NonZero<u64>)
Same as self /= other.get(), but because other is a NonZero<_>,
thereโs never a runtime check for division-by-zero.
This operation rounds towards zero, truncating any fractional part of the exact result, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl DivAssign<NonZero<u8>> for u8
impl DivAssign<NonZero<u8>> for u8
Sourceยงfn div_assign(&mut self, other: NonZero<u8>)
fn div_assign(&mut self, other: NonZero<u8>)
Same as self /= other.get(), but because other is a NonZero<_>,
thereโs never a runtime check for division-by-zero.
This operation rounds towards zero, truncating any fractional part of the exact result, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl DivAssign<NonZero<usize>> for usize
impl DivAssign<NonZero<usize>> for usize
Sourceยงfn div_assign(&mut self, other: NonZero<usize>)
fn div_assign(&mut self, other: NonZero<usize>)
Same as self /= other.get(), but because other is a NonZero<_>,
thereโs never a runtime check for division-by-zero.
This operation rounds towards zero, truncating any fractional part of the exact result, and cannot panic.
ยงimpl<'q, DB> Encode<'q, DB> for NonZero<i16>where
DB: Database,
i16: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for NonZero<i16>where
DB: Database,
i16: Encode<'q, DB>,
ยงfn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
ยงfn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
ยงimpl<'q, DB> Encode<'q, DB> for NonZero<i32>where
DB: Database,
i32: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for NonZero<i32>where
DB: Database,
i32: Encode<'q, DB>,
ยงfn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
ยงfn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
ยงimpl<'q, DB> Encode<'q, DB> for NonZero<i64>where
DB: Database,
i64: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for NonZero<i64>where
DB: Database,
i64: Encode<'q, DB>,
ยงfn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
ยงfn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
ยงimpl<'q, DB> Encode<'q, DB> for NonZero<i8>where
DB: Database,
i8: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for NonZero<i8>where
DB: Database,
i8: Encode<'q, DB>,
ยงfn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
ยงfn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
ยงimpl<'q, DB> Encode<'q, DB> for NonZero<u16>where
DB: Database,
u16: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for NonZero<u16>where
DB: Database,
u16: Encode<'q, DB>,
ยงfn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
ยงfn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
ยงimpl<'q, DB> Encode<'q, DB> for NonZero<u32>where
DB: Database,
u32: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for NonZero<u32>where
DB: Database,
u32: Encode<'q, DB>,
ยงfn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
ยงfn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
ยงimpl<'q, DB> Encode<'q, DB> for NonZero<u64>where
DB: Database,
u64: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for NonZero<u64>where
DB: Database,
u64: Encode<'q, DB>,
ยงfn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
ยงfn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
ยงimpl<'q, DB> Encode<'q, DB> for NonZero<u8>where
DB: Database,
u8: Encode<'q, DB>,
impl<'q, DB> Encode<'q, DB> for NonZero<u8>where
DB: Database,
u8: Encode<'q, DB>,
ยงfn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
ยงfn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>
fn encode( self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, Box<dyn Error + Send + Sync>>
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
ยงimpl IntoBytes for NonZero<i128>
impl IntoBytes for NonZero<i128>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<i16>
impl IntoBytes for NonZero<i16>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<i32>
impl IntoBytes for NonZero<i32>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<i64>
impl IntoBytes for NonZero<i64>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<i8>
impl IntoBytes for NonZero<i8>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<isize>
impl IntoBytes for NonZero<isize>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<u128>
impl IntoBytes for NonZero<u128>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<u16>
impl IntoBytes for NonZero<u16>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<u32>
impl IntoBytes for NonZero<u32>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<u64>
impl IntoBytes for NonZero<u64>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<u8>
impl IntoBytes for NonZero<u8>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl IntoBytes for NonZero<usize>
impl IntoBytes for NonZero<usize>
ยงfn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] โwhere
Self: FromBytes,
ยงfn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
ยงimpl KnownLayout for NonZero<i128>
impl KnownLayout for NonZero<i128>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<i16>
impl KnownLayout for NonZero<i16>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<i32>
impl KnownLayout for NonZero<i32>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<i64>
impl KnownLayout for NonZero<i64>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<i8>
impl KnownLayout for NonZero<i8>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<isize>
impl KnownLayout for NonZero<isize>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<u128>
impl KnownLayout for NonZero<u128>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<u16>
impl KnownLayout for NonZero<u16>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<u32>
impl KnownLayout for NonZero<u32>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<u64>
impl KnownLayout for NonZero<u64>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<u8>
impl KnownLayout for NonZero<u8>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreยงimpl KnownLayout for NonZero<usize>
impl KnownLayout for NonZero<usize>
ยงtype PointerMetadata = ()
type PointerMetadata = ()
Self. Read moreยงfn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read more1.28.0 (const: unstable) ยท Sourceยงimpl<T> Ord for NonZero<T>where
T: ZeroablePrimitive + Ord,
impl<T> Ord for NonZero<T>where
T: ZeroablePrimitive + Ord,
1.28.0 (const: unstable) ยท Sourceยงimpl<T> PartialEq for NonZero<T>where
T: ZeroablePrimitive + PartialEq,
impl<T> PartialEq for NonZero<T>where
T: ZeroablePrimitive + PartialEq,
1.28.0 (const: unstable) ยท Sourceยงimpl<T> PartialOrd for NonZero<T>where
T: ZeroablePrimitive + PartialOrd,
impl<T> PartialOrd for NonZero<T>where
T: ZeroablePrimitive + PartialOrd,
ยงimpl PatchField for NonZero<i128>
impl PatchField for NonZero<i128>
ยงfn patch_field(
&mut self,
new: NonZero<i128>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i128>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i128>
impl PatchField for NonZero<i128>
ยงfn patch_field(
&mut self,
new: NonZero<i128>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i128>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i16>
impl PatchField for NonZero<i16>
ยงfn patch_field(
&mut self,
new: NonZero<i16>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i16>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i16>
impl PatchField for NonZero<i16>
ยงfn patch_field(
&mut self,
new: NonZero<i16>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i16>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i32>
impl PatchField for NonZero<i32>
ยงfn patch_field(
&mut self,
new: NonZero<i32>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i32>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i32>
impl PatchField for NonZero<i32>
ยงfn patch_field(
&mut self,
new: NonZero<i32>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i32>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i64>
impl PatchField for NonZero<i64>
ยงfn patch_field(
&mut self,
new: NonZero<i64>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i64>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i64>
impl PatchField for NonZero<i64>
ยงfn patch_field(
&mut self,
new: NonZero<i64>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i64>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i8>
impl PatchField for NonZero<i8>
ยงfn patch_field(
&mut self,
new: NonZero<i8>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i8>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<i8>
impl PatchField for NonZero<i8>
ยงfn patch_field(
&mut self,
new: NonZero<i8>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<i8>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<isize>
impl PatchField for NonZero<isize>
ยงfn patch_field(
&mut self,
new: NonZero<isize>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<isize>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<isize>
impl PatchField for NonZero<isize>
ยงfn patch_field(
&mut self,
new: NonZero<isize>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<isize>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u128>
impl PatchField for NonZero<u128>
ยงfn patch_field(
&mut self,
new: NonZero<u128>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u128>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u128>
impl PatchField for NonZero<u128>
ยงfn patch_field(
&mut self,
new: NonZero<u128>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u128>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u16>
impl PatchField for NonZero<u16>
ยงfn patch_field(
&mut self,
new: NonZero<u16>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u16>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u16>
impl PatchField for NonZero<u16>
ยงfn patch_field(
&mut self,
new: NonZero<u16>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u16>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u32>
impl PatchField for NonZero<u32>
ยงfn patch_field(
&mut self,
new: NonZero<u32>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u32>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u32>
impl PatchField for NonZero<u32>
ยงfn patch_field(
&mut self,
new: NonZero<u32>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u32>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u64>
impl PatchField for NonZero<u64>
ยงfn patch_field(
&mut self,
new: NonZero<u64>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u64>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u64>
impl PatchField for NonZero<u64>
ยงfn patch_field(
&mut self,
new: NonZero<u64>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u64>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u8>
impl PatchField for NonZero<u8>
ยงfn patch_field(
&mut self,
new: NonZero<u8>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u8>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<u8>
impl PatchField for NonZero<u8>
ยงfn patch_field(
&mut self,
new: NonZero<u8>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<u8>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<usize>
impl PatchField for NonZero<usize>
ยงfn patch_field(
&mut self,
new: NonZero<usize>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<usize>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
ยงimpl PatchField for NonZero<usize>
impl PatchField for NonZero<usize>
ยงfn patch_field(
&mut self,
new: NonZero<usize>,
path: &StorePath,
notify: &mut dyn FnMut(&StorePath),
)
fn patch_field( &mut self, new: NonZero<usize>, path: &StorePath, notify: &mut dyn FnMut(&StorePath), )
1.79.0 (const: unstable) ยท Sourceยงimpl RemAssign<NonZero<u128>> for u128
impl RemAssign<NonZero<u128>> for u128
Sourceยงfn rem_assign(&mut self, other: NonZero<u128>)
fn rem_assign(&mut self, other: NonZero<u128>)
This operation satisfies n % d == n - (n / d) * d, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl RemAssign<NonZero<u16>> for u16
impl RemAssign<NonZero<u16>> for u16
Sourceยงfn rem_assign(&mut self, other: NonZero<u16>)
fn rem_assign(&mut self, other: NonZero<u16>)
This operation satisfies n % d == n - (n / d) * d, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl RemAssign<NonZero<u32>> for u32
impl RemAssign<NonZero<u32>> for u32
Sourceยงfn rem_assign(&mut self, other: NonZero<u32>)
fn rem_assign(&mut self, other: NonZero<u32>)
This operation satisfies n % d == n - (n / d) * d, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl RemAssign<NonZero<u64>> for u64
impl RemAssign<NonZero<u64>> for u64
Sourceยงfn rem_assign(&mut self, other: NonZero<u64>)
fn rem_assign(&mut self, other: NonZero<u64>)
This operation satisfies n % d == n - (n / d) * d, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl RemAssign<NonZero<u8>> for u8
impl RemAssign<NonZero<u8>> for u8
Sourceยงfn rem_assign(&mut self, other: NonZero<u8>)
fn rem_assign(&mut self, other: NonZero<u8>)
This operation satisfies n % d == n - (n / d) * d, and cannot panic.
1.79.0 (const: unstable) ยท Sourceยงimpl RemAssign<NonZero<usize>> for usize
impl RemAssign<NonZero<usize>> for usize
Sourceยงfn rem_assign(&mut self, other: NonZero<usize>)
fn rem_assign(&mut self, other: NonZero<usize>)
This operation satisfies n % d == n - (n / d) * d, and cannot panic.
ยงimpl Render for NonZero<i128>
impl Render for NonZero<i128>
ยงimpl Render for NonZero<i16>
impl Render for NonZero<i16>
ยงimpl Render for NonZero<i32>
impl Render for NonZero<i32>
ยงimpl Render for NonZero<i64>
impl Render for NonZero<i64>
ยงimpl Render for NonZero<i8>
impl Render for NonZero<i8>
ยงimpl Render for NonZero<isize>
impl Render for NonZero<isize>
ยงimpl Render for NonZero<u128>
impl Render for NonZero<u128>
ยงimpl Render for NonZero<u16>
impl Render for NonZero<u16>
ยงimpl Render for NonZero<u32>
impl Render for NonZero<u32>
ยงimpl Render for NonZero<u64>
impl Render for NonZero<u64>
ยงimpl Render for NonZero<u8>
impl Render for NonZero<u8>
ยงimpl Render for NonZero<usize>
impl Render for NonZero<usize>
ยงimpl RenderHtml for NonZero<i128>
impl RenderHtml for NonZero<i128>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<i128>
type AsyncOutput = NonZero<i128>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<i128> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<i128> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<i128> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<i128> as Render>::State
ยงfn into_owned(self) -> <NonZero<i128> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<i128> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<i16>
impl RenderHtml for NonZero<i16>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<i16>
type AsyncOutput = NonZero<i16>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<i16> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<i16> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<i16> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<i16> as Render>::State
ยงfn into_owned(self) -> <NonZero<i16> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<i16> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<i32>
impl RenderHtml for NonZero<i32>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<i32>
type AsyncOutput = NonZero<i32>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<i32> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<i32> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<i32> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<i32> as Render>::State
ยงfn into_owned(self) -> <NonZero<i32> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<i32> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<i64>
impl RenderHtml for NonZero<i64>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<i64>
type AsyncOutput = NonZero<i64>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<i64> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<i64> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<i64> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<i64> as Render>::State
ยงfn into_owned(self) -> <NonZero<i64> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<i64> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<i8>
impl RenderHtml for NonZero<i8>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<i8>
type AsyncOutput = NonZero<i8>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<i8> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<i8> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<i8> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<i8> as Render>::State
ยงfn into_owned(self) -> <NonZero<i8> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<i8> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<isize>
impl RenderHtml for NonZero<isize>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<isize>
type AsyncOutput = NonZero<isize>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<isize> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<isize> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<isize> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<isize> as Render>::State
ยงfn into_owned(self) -> <NonZero<isize> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<isize> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<u128>
impl RenderHtml for NonZero<u128>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<u128>
type AsyncOutput = NonZero<u128>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<u128> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<u128> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<u128> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<u128> as Render>::State
ยงfn into_owned(self) -> <NonZero<u128> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<u128> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<u16>
impl RenderHtml for NonZero<u16>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<u16>
type AsyncOutput = NonZero<u16>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<u16> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<u16> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<u16> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<u16> as Render>::State
ยงfn into_owned(self) -> <NonZero<u16> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<u16> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<u32>
impl RenderHtml for NonZero<u32>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<u32>
type AsyncOutput = NonZero<u32>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<u32> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<u32> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<u32> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<u32> as Render>::State
ยงfn into_owned(self) -> <NonZero<u32> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<u32> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<u64>
impl RenderHtml for NonZero<u64>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<u64>
type AsyncOutput = NonZero<u64>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<u64> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<u64> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<u64> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<u64> as Render>::State
ยงfn into_owned(self) -> <NonZero<u64> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<u64> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<u8>
impl RenderHtml for NonZero<u8>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<u8>
type AsyncOutput = NonZero<u8>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<u8> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<u8> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<u8> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<u8> as Render>::State
ยงfn into_owned(self) -> <NonZero<u8> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<u8> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.ยงimpl RenderHtml for NonZero<usize>
impl RenderHtml for NonZero<usize>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = NonZero<usize>
type AsyncOutput = NonZero<usize>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงasync fn resolve(self) -> <NonZero<usize> as RenderHtml>::AsyncOutput
async fn resolve(self) -> <NonZero<usize> as RenderHtml>::AsyncOutput
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
_escape: bool,
_mark_branches: bool,
_extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, _escape: bool, _mark_branches: bool, _extra_attrs: Vec<AnyAttribute>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <NonZero<usize> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <NonZero<usize> as Render>::State
ยงfn into_owned(self) -> <NonZero<usize> as RenderHtml>::Owned
fn into_owned(self) -> <NonZero<usize> as RenderHtml>::Owned
'static.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
fn to_html_async_with_buf<const OUT_OF_ORDER: bool>(
self,
buf: &mut StreamBuilder,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)where
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate, beginning at the given element and position.Sourceยงimpl Serialize for NonZero<i128>
impl Serialize for NonZero<i128>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<i16>
impl Serialize for NonZero<i16>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<i32>
impl Serialize for NonZero<i32>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<i64>
impl Serialize for NonZero<i64>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<i8>
impl Serialize for NonZero<i8>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<isize>
impl Serialize for NonZero<isize>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<u128>
impl Serialize for NonZero<u128>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<u16>
impl Serialize for NonZero<u16>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<u32>
impl Serialize for NonZero<u32>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<u64>
impl Serialize for NonZero<u64>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<u8>
impl Serialize for NonZero<u8>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Sourceยงimpl Serialize for NonZero<usize>
impl Serialize for NonZero<usize>
Sourceยงfn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
ยงimpl<'a> ToTemplate for NonZero<i128>
impl<'a> ToTemplate for NonZero<i128>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<i16>
impl<'a> ToTemplate for NonZero<i16>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<i32>
impl<'a> ToTemplate for NonZero<i32>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<i64>
impl<'a> ToTemplate for NonZero<i64>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<i8>
impl<'a> ToTemplate for NonZero<i8>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<isize>
impl<'a> ToTemplate for NonZero<isize>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<u128>
impl<'a> ToTemplate for NonZero<u128>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<u16>
impl<'a> ToTemplate for NonZero<u16>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<u32>
impl<'a> ToTemplate for NonZero<u32>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<u64>
impl<'a> ToTemplate for NonZero<u64>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<u8>
impl<'a> ToTemplate for NonZero<u8>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl<'a> ToTemplate for NonZero<usize>
impl<'a> ToTemplate for NonZero<usize>
ยงfn to_template(
buf: &mut String,
_class: &mut String,
_style: &mut String,
_inner_html: &mut String,
position: &mut Position,
)
fn to_template( buf: &mut String, _class: &mut String, _style: &mut String, _inner_html: &mut String, position: &mut Position, )
<template> that corresponds
to a view of a particular type.ยงimpl TryFromBytes for NonZero<i128>
impl TryFromBytes for NonZero<i128>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<i16>
impl TryFromBytes for NonZero<i16>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<i32>
impl TryFromBytes for NonZero<i32>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<i64>
impl TryFromBytes for NonZero<i64>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<i8>
impl TryFromBytes for NonZero<i8>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<isize>
impl TryFromBytes for NonZero<isize>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<u128>
impl TryFromBytes for NonZero<u128>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<u16>
impl TryFromBytes for NonZero<u16>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<u32>
impl TryFromBytes for NonZero<u32>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<u64>
impl TryFromBytes for NonZero<u64>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<u8>
impl TryFromBytes for NonZero<u8>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl TryFromBytes for NonZero<usize>
impl TryFromBytes for NonZero<usize>
ยงfn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
fn try_ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout + Immutable,
ยงfn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_bytes(
bytes: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
fn try_mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout + IntoBytes,
ยงfn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_bytes_with_elems(
source: &[u8],
count: usize,
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
ยงfn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_prefix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
fn try_ref_from_suffix_with_elems(
source: &[u8],
count: usize,
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + Immutable,
source as a &Self with
a DST length equal to count. Read moreยงfn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_bytes_with_elems(
source: &mut [u8],
count: usize,
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
ยงfn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_prefix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
fn try_mut_from_suffix_with_elems(
source: &mut [u8],
count: usize,
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>where
Self: KnownLayout<PointerMetadata = usize> + IntoBytes,
source as a &mut Self
with a DST length equal to count. Read moreยงfn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงfn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
ยงimpl ULE for NonZero<u8>
impl ULE for NonZero<u8>
ยงfn parse_bytes_to_slice(bytes: &[u8]) -> Result<&[Self], UleError>
fn parse_bytes_to_slice(bytes: &[u8]) -> Result<&[Self], UleError>
ยงunsafe fn slice_from_bytes_unchecked(bytes: &[u8]) -> &[Self]
unsafe fn slice_from_bytes_unchecked(bytes: &[u8]) -> &[Self]
&[u8], and return it as &[Self] with the same lifetime, assuming
that this byte slice has previously been run through [Self::parse_bytes_to_slice()] with
success. Read moreยงfn slice_as_bytes(slice: &[Self]) -> &[u8] โ
fn slice_as_bytes(slice: &[Self]) -> &[u8] โ
impl<T> Copy for NonZero<T>where
T: ZeroablePrimitive,
impl<T> Eq for NonZero<T>where
T: ZeroablePrimitive + Eq,
impl EqULE for NonZero<u8>
impl<T> Freeze for NonZero<T>where
T: ZeroablePrimitive + Freeze,
impl Immutable for NonZero<i128>
impl Immutable for NonZero<i16>
impl Immutable for NonZero<i32>
impl Immutable for NonZero<i64>
impl Immutable for NonZero<i8>
impl Immutable for NonZero<isize>
impl Immutable for NonZero<u128>
impl Immutable for NonZero<u16>
impl Immutable for NonZero<u32>
impl Immutable for NonZero<u64>
impl Immutable for NonZero<u8>
impl Immutable for NonZero<usize>
impl<T> RefUnwindSafe for NonZero<T>where
T: ZeroablePrimitive + RefUnwindSafe,
impl<T> Send for NonZero<T>where
T: ZeroablePrimitive + Send,
impl<T> StructuralPartialEq for NonZero<T>where
T: ZeroablePrimitive + StructuralPartialEq,
impl<T> Sync for NonZero<T>where
T: ZeroablePrimitive + Sync,
impl Unaligned for NonZero<i8>
impl Unaligned for NonZero<u8>
impl<T> Unpin for NonZero<T>where
T: ZeroablePrimitive + Unpin,
impl<T> UnwindSafe for NonZero<T>where
T: ZeroablePrimitive + UnwindSafe,
impl<T> UseCloned for NonZero<T>where
T: ZeroablePrimitive,
Blanket Implementationsยง
Sourceยงimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Sourceยงfn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Sourceยงfn adapt_into(self) -> D
fn adapt_into(self) -> D
Sourceยงimpl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Sourceยงfn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Sourceยงimpl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Sourceยงfn arrays_into(self) -> C
fn arrays_into(self) -> C
ยงimpl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for Vwhere
V: AddAnyAttr,
Key: AttributeKey,
Sig: IntoSplitSignal<Value = T>,
T: FromEventTarget + AttributeValue + PartialEq + Sync + 'static,
Signal<BoolOrT<T>>: IntoProperty,
<Sig as IntoSplitSignal>::Read: Get<Value = T> + Send + Sync + Clone + 'static,
<Sig as IntoSplitSignal>::Write: Send + Clone + 'static,
Element: GetValue<T>,
impl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for Vwhere
V: AddAnyAttr,
Key: AttributeKey,
Sig: IntoSplitSignal<Value = T>,
T: FromEventTarget + AttributeValue + PartialEq + Sync + 'static,
Signal<BoolOrT<T>>: IntoProperty,
<Sig as IntoSplitSignal>::Read: Get<Value = T> + Send + Sync + Clone + 'static,
<Sig as IntoSplitSignal>::Write: Send + Clone + 'static,
Element: GetValue<T>,
ยงtype Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>
type Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>
ยงfn bind(
self,
key: Key,
signal: Sig,
) -> <V as BindAttribute<Key, Sig, T>>::Output
fn bind( self, key: Key, signal: Sig, ) -> <V as BindAttribute<Key, Sig, T>>::Output
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Sourceยงimpl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Sourceยงtype Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Sourceยงfn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงimpl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Sourceยงimpl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Sourceยงfn components_from(colors: C) -> T
fn components_from(colors: C) -> T
ยงimpl<T, K, V> CustomAttribute<K, V> for Twhere
T: AddAnyAttr,
K: CustomAttributeKey,
V: AttributeValue,
impl<T, K, V> CustomAttribute<K, V> for Twhere
T: AddAnyAttr,
K: CustomAttributeKey,
V: AttributeValue,
ยงimpl<V, T, P, D> DirectiveAttribute<T, P, D> for Vwhere
V: AddAnyAttr,
D: IntoDirective<T, P>,
P: Clone + 'static,
T: 'static,
impl<V, T, P, D> DirectiveAttribute<T, P, D> for Vwhere
V: AddAnyAttr,
D: IntoDirective<T, P>,
P: Clone + 'static,
T: 'static,
ยงtype Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>
type Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>
ยงfn directive(
self,
handler: D,
param: P,
) -> <V as DirectiveAttribute<T, P, D>>::Output
fn directive( self, handler: D, param: P, ) -> <V as DirectiveAttribute<T, P, D>>::Output
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
ยงfn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.ยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.ยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Anyโs vtable from &Traitโs.ยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Anyโs vtable from &mut Traitโs.ยงimpl<T> DowncastSend for T
impl<T> DowncastSend for T
ยงimpl<T> DowncastSync for T
impl<T> DowncastSync for T
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Sourceยงimpl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Sourceยงfn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.ยงimpl<T> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
ยงfn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
submit event.ยงfn from_form_data(form_data: &FormData) -> Result<T, Error>
fn from_form_data(form_data: &FormData) -> Result<T, Error>
Sourceยงimpl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Sourceยงfn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.ยงimpl<T> Hexable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<T> Hexable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
Sourceยงimpl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Sourceยงfn into_angle(self) -> U
fn into_angle(self) -> U
T.ยงimpl<T> IntoAny for Twhere
T: Send + RenderHtml,
impl<T> IntoAny for Twhere
T: Send + RenderHtml,
ยงimpl<T> IntoAttributeValue for Twhere
T: AttributeValue,
impl<T> IntoAttributeValue for Twhere
T: AttributeValue,
ยงfn into_attribute_value(self) -> <T as IntoAttributeValue>::Output
fn into_attribute_value(self) -> <T as IntoAttributeValue>::Output
Sourceยงimpl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Sourceยงtype Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Sourceยงfn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Sourceยงimpl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Sourceยงfn into_color(self) -> U
fn into_color(self) -> U
Sourceยงimpl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Sourceยงfn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self> โ
fn into_either(self, into_left: bool) -> Either<Self, Self> โ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreยงimpl<T> IntoMaybeErased for Twhere
T: RenderHtml,
impl<T> IntoMaybeErased for Twhere
T: RenderHtml,
ยงfn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output
fn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output
ยงimpl<T, I> IntoReactiveValue<T, __IntoReactiveValueMarkerBaseCase> for Iwhere
I: Into<T>,
impl<T, I> IntoReactiveValue<T, __IntoReactiveValueMarkerBaseCase> for Iwhere
I: Into<T>,
ยงfn into_reactive_value(self) -> T
fn into_reactive_value(self) -> T
self into a T.ยงimpl<T> IntoRender for Twhere
T: Render,
impl<T> IntoRender for Twhere
T: Render,
ยงfn into_render(self) -> <T as IntoRender>::Output
fn into_render(self) -> <T as IntoRender>::Output
Sourceยงimpl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Sourceยงfn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.ยงimpl<T> Pointable for T
impl<T> Pointable for T
ยงimpl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
ยงimpl<T> SerializableKey for T
impl<T> SerializableKey for T
ยงimpl<T> SliceAsULE for Twhere
T: EqULE,
impl<T> SliceAsULE for Twhere
T: EqULE,
ยงfn slice_to_unaligned(slice: &[T]) -> Option<&[<T as AsULE>::ULE]>
fn slice_to_unaligned(slice: &[T]) -> Option<&[<T as AsULE>::ULE]>
ยงimpl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
ยงfn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
ยงfn into_taken(self) -> T
fn into_taken(self) -> T
ยงimpl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
ยงfn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.
Sourceยงimpl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Sourceยงtype Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Sourceยงfn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Sourceยงimpl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Sourceยงfn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more