Crate num_traits
source ·Expand description
Numeric traits for generic mathematics
§Compatibility
The num-traits
crate is tested for rustc 1.60 and greater.
Re-exports§
pub use crate::bounds::Bounded;
pub use crate::float::FloatConst;
pub use crate::cast::cast;
pub use crate::cast::AsPrimitive;
pub use crate::cast::FromPrimitive;
pub use crate::cast::NumCast;
pub use crate::cast::ToPrimitive;
pub use crate::identities::one;
pub use crate::identities::zero;
pub use crate::identities::ConstOne;
pub use crate::identities::ConstZero;
pub use crate::identities::One;
pub use crate::identities::Zero;
pub use crate::int::PrimInt;
pub use crate::ops::bytes::FromBytes;
pub use crate::ops::bytes::ToBytes;
pub use crate::ops::checked::CheckedAdd;
pub use crate::ops::checked::CheckedDiv;
pub use crate::ops::checked::CheckedMul;
pub use crate::ops::checked::CheckedNeg;
pub use crate::ops::checked::CheckedRem;
pub use crate::ops::checked::CheckedShl;
pub use crate::ops::checked::CheckedShr;
pub use crate::ops::checked::CheckedSub;
pub use crate::ops::euclid::CheckedEuclid;
pub use crate::ops::euclid::Euclid;
pub use crate::ops::inv::Inv;
pub use crate::ops::mul_add::MulAdd;
pub use crate::ops::mul_add::MulAddAssign;
pub use crate::ops::saturating::Saturating;
pub use crate::ops::saturating::SaturatingAdd;
pub use crate::ops::saturating::SaturatingMul;
pub use crate::ops::saturating::SaturatingSub;
pub use crate::ops::wrapping::WrappingAdd;
pub use crate::ops::wrapping::WrappingMul;
pub use crate::ops::wrapping::WrappingNeg;
pub use crate::ops::wrapping::WrappingShl;
pub use crate::ops::wrapping::WrappingShr;
pub use crate::ops::wrapping::WrappingSub;
pub use crate::pow::checked_pow;
pub use crate::pow::pow;
pub use crate::pow::Pow;
pub use crate::sign::abs;
pub use crate::sign::abs_sub;
pub use crate::sign::signum;
pub use crate::sign::Signed;
pub use crate::sign::Unsigned;
Modules§
Structs§
Enums§
Traits§
- The base trait for numeric types, covering
0
and1
values, comparisons, basic numeric operations, and string conversion. - The trait for
Num
types which also implement assignment operators. - Generic trait for types implementing numeric assignment operators (like
+=
). - The trait for
NumAssign
types which also implement assignment operations taking the second operand by reference. - Generic trait for types implementing basic numeric operations
- The trait for
Num
types which also implement numeric operations taking the second operand by reference. - The trait for
Num
references which implement numeric operations, taking the second operand either by value or by reference.
Functions§
- A value bounded by a minimum and a maximum
- A value bounded by a maximum value
- A value bounded by a minimum value