doc.rust-lang.org
pub mod num
Numeric traits and functions for the built-in numeric types.
module
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub enum FpCategory
A classification of floating point numbers.
enum
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub enum IntErrorKind
Enum to store the various types of errors that can cause parsing or converting an integer to fail.
enum
core
Stable since 1.55.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct ParseIntError
An error which can be returned when parsing an integer.
struct
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn kind(&self) -> &IntErrorKind
Outputs the detailed cause of parsing an integer failing.
method
core
Stable since 1.55.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct TryFromIntError
The error type returned when a checked integral type conversion fails.
struct
core
Stable since 1.34.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct ParseFloatError
An error which can be returned when parsing a float.
struct
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct NonZero<T>
A value that is known not to equal zero.
struct
core
Stable since 1.79.0
Version 1.100.0-nightly
doc.rust-lang.org
const BITS: u32
The size of this non-zero integer type in bits.
associated_constant
core
Stable since 1.67.0
Version 1.100.0-nightly
doc.rust-lang.org
const MAX: Self
The largest value that can be represented by this non-zero integer type, equal to u8::MAX.
associated_constant
core
Stable since 1.70.0
Version 1.100.0-nightly
doc.rust-lang.org
const MIN: Self
The smallest value that can be represented by this non-zero integer type, 1.
associated_constant
core
Stable since 1.70.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn abs(self) -> Self
Computes the absolute value of self. See i8::abs for documentation on overflow behavior.
method
core
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn bit_width(self) -> NonZero<u32>
Returns the minimum number of bits required to represent self.
method
core
Stable since 1.97.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn cast_signed(self) -> NonZero<i8>
Returns the bit pattern of self reinterpreted as a signed integer of the same size.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn cast_unsigned(self) -> NonZero<u8>
Returns the bit pattern of self reinterpreted as an unsigned integer of the same size.
method
core
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn checked_abs(self) -> Option<Self>
Checked absolute value. Checks for overflow and returns None if self == NonZero::<i8>::MIN. The result cannot be zero.
method
core
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn checked_add(self, other: u8) -> Option<Self>
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.
method
core
Stable since 1.64.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn checked_mul(self, other: Self) -> Option<Self>
Multiplies two non-zero integers together. 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_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
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