doc.rust-lang.org
pub const fn new(n: T) -> Option<Self>
Creates a non-zero if the given value is not zero.
associated_function
core
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn midpoint(self, rhs: Self) -> Self
Calculates the midpoint (average) between self and rhs.
method
core
Stable since 1.85.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn lowest_one(self) -> u32
Returns the index of the lowest bit set to one in self.
method
core
Stable since 1.97.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
method
core
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn isqrt(self) -> Self
Returns the square root of the number, rounded down.
method
core
Stable since 1.84.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn isolate_lowest_one(self) -> Self
Returns self with only the least significant bit set.
method
core
Stable since 1.97.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn isolate_highest_one(self) -> Self
Returns self with only the most significant bit set.
method
core
Stable since 1.97.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_power_of_two(self) -> bool
Returns true if and only if self == (1 << k) for some k.
method
core
Stable since 1.59.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_positive(self) -> bool
Returns true if self is positive and false if the number is negative.
method
core
Stable since 1.71.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_negative(self) -> bool
Returns true if self is negative and false if the number is positive.
method
core
Stable since 1.71.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn ilog2(self) -> u32
Returns the base 2 logarithm of the number, rounded down.
method
core
Stable since 1.67.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn ilog10(self) -> u32
Returns the base 10 logarithm of the number, rounded down.
method
core
Stable since 1.67.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn highest_one(self) -> u32
Returns the index of the highest bit set to one in self.
method
core
Stable since 1.97.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn get(self) -> T
Returns the contained value as a primitive type.
method
core
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>
Parses a non-zero integer from a string slice with digits in a given base.
associated_function
core
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn div_ceil(self, rhs: Self) -> Self
Calculates the quotient of self and rhs, rounding the result towards positive infinity.
method
core
Stable since 1.92.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn count_ones(self) -> NonZero<u32>
Returns the number of ones in the binary representation of self.
method
core
Stable since 1.86.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn checked_pow(self, other: u32) -> Option<Self>
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.
method
core
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn checked_next_power_of_two(self) -> Option<Self>
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.
method
core
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn checked_neg(self) -> Option<Self>
Checked negation. Computes -self, returning None if self == NonZero::<i8>::MIN.
method
core
Stable since 1.71.0
Version 1.100.0-nightly