num_traits - Rust
Description: Numeric traits for generic mathematics
Keywords: rust, rustlang, rust-lang, num_traits

# Crate num_traits

source ·
Expand description

Numeric traits for generic mathematics

### Compatibility

The `num-traits` crate is tested for rustc 1.8 and greater.

## Re-exports

`pub use bounds::Bounded;`
`pub use float::Float;`
`pub use float::FloatConst;`
`pub use cast::cast;`
`pub use cast::AsPrimitive;`
`pub use cast::FromPrimitive;`
`pub use cast::NumCast;`
`pub use cast::ToPrimitive;`
`pub use identities::one;`
`pub use identities::zero;`
`pub use identities::One;`
`pub use identities::Zero;`
`pub use int::PrimInt;`
`pub use ops::checked::CheckedAdd;`
`pub use ops::checked::CheckedDiv;`
`pub use ops::checked::CheckedMul;`
`pub use ops::checked::CheckedNeg;`
`pub use ops::checked::CheckedRem;`
`pub use ops::checked::CheckedShl;`
`pub use ops::checked::CheckedShr;`
`pub use ops::checked::CheckedSub;`
`pub use ops::euclid::CheckedEuclid;`
`pub use ops::euclid::Euclid;`
`pub use ops::inv::Inv;`
`pub use ops::mul_add::MulAdd;`
`pub use ops::mul_add::MulAddAssign;`
`pub use ops::saturating::Saturating;`
`pub use ops::saturating::SaturatingAdd;`
`pub use ops::saturating::SaturatingMul;`
`pub use ops::saturating::SaturatingSub;`
`pub use ops::wrapping::WrappingAdd;`
`pub use ops::wrapping::WrappingMul;`
`pub use ops::wrapping::WrappingNeg;`
`pub use ops::wrapping::WrappingShl;`
`pub use ops::wrapping::WrappingShr;`
`pub use ops::wrapping::WrappingSub;`
`pub use pow::checked_pow;`
`pub use pow::pow;`
`pub use pow::Pow;`
`pub use sign::abs;`
`pub use sign::abs_sub;`
`pub use sign::signum;`
`pub use sign::Signed;`
`pub use sign::Unsigned;`

## Modules

bounds
cast
float
identities
int
ops
pow
real
sign

## Structs

ParseFloatError

## Enums

FloatErrorKind

## Traits

Num
The base trait for numeric types, covering `0` and `1` values, comparisons, basic numeric operations, and string conversion.
NumAssign
The trait for `Num` types which also implement assignment operators.
NumAssignOps
Generic trait for types implementing numeric assignment operators (like `+=`).
NumAssignRef
The trait for `NumAssign` types which also implement assignment operations taking the second operand by reference.
NumOps
Generic trait for types implementing basic numeric operations
NumRef
The trait for `Num` types which also implement numeric operations taking the second operand by reference.
RefNum
The trait for `Num` references which implement numeric operations, taking the second operand either by value or by reference.

## Functions

clamp
A value bounded by a minimum and a maximum
clamp_max
A value bounded by a maximum value
clamp_min
A value bounded by a minimum value