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§
- Num
- The base trait for numeric types, covering
0and1values, comparisons, basic numeric operations, and string conversion. - NumAssign
- The trait for
Numtypes which also implement assignment operators. - NumAssign
Ops - Generic trait for types implementing numeric assignment operators (like
+=). - NumAssign
Ref - The trait for
NumAssigntypes which also implement assignment operations taking the second operand by reference. - NumOps
- Generic trait for types implementing basic numeric operations
- NumRef
- The trait for
Numtypes which also implement numeric operations taking the second operand by reference. - RefNum
- The trait for
Numreferences which implement numeric operations, taking the second operand either by value or by reference.