[][src]Module sp_arithmetic::traits

Primitive traits for the runtime arithmetic.

Traits

AtLeast32Bit

A meta trait for arithmetic.

BaseArithmetic

A meta trait for arithmetic type operations, regardless of any limitation on size.

Bounded

Numbers which have upper and lower bounds

CheckedAdd

Performs addition that returns None instead of wrapping around on overflow.

CheckedDiv

Performs division that returns None instead of panicking on division by zero and instead of wrapping around on underflow and overflow.

CheckedMul

Performs multiplication that returns None instead of wrapping around on underflow or overflow.

CheckedShl

Performs a left shift that returns None on shifts larger than the type width.

CheckedShr

Performs a right shift that returns None on shifts larger than the type width.

CheckedSub

Performs subtraction that returns None instead of wrapping around on underflow.

IntegerSquareRoot

A trait implementing integer square root.

One

Defines a multiplicative identity element for Self.

SaturatedConversion

Convenience type to work around the highly unergonomic syntax needed to invoke the functions of overloaded generic traits, in this case SaturatedFrom and SaturatedInto.

Saturating

Simple trait to use checked mul and max value to give a saturated mul operation over supported types.

UniqueSaturatedFrom

Just like From except that if the source value is too big to fit into the destination type then it'll saturate the destination.

UniqueSaturatedInto

Just like Into except that if the source value is too big to fit into the destination type then it'll saturate the destination.

Zero

Defines an additive identity element for Self.