Go to file
Fabian Schuiki 21dfae004c Add checked shifts
Add traits `CheckedShl` and `CheckedShr` that correspond to the standard
library's `checked_shl` and `checked_shr` functions. Implement the trait
on all primitive integer types by default, akin to what the standard
library does.

The stdlib is somewhat inconsistent when it comes to the type of the
shift amount. The `checked_*` functions have a `u32` shift amount, but
the `std::ops::{Shl,Shr}` traits are generic over the shift amount. Also
the stdlib implements these traits for all primitive integer types as
right-hand sides. Our implementation mimics this behaviour.
2018-01-03 16:25:13 +01:00
ci Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
src Add checked shifts 2018-01-03 16:25:13 +01:00
.gitignore Update num-macros to Rust master 2015-05-14 10:19:47 -07:00
.travis.yml Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
Cargo.toml Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
LICENSE-APACHE Initial seeding from rust repo 2014-09-16 10:35:35 -07:00
LICENSE-MIT Initial seeding from rust repo 2014-09-16 10:35:35 -07:00
README.md Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
bors.toml Enable bors-ng 2017-07-08 22:29:48 -07:00

README.md

num-traits

crate documentation Travis status

Numeric traits for generic mathematics in Rust.

Usage

Add this to your Cargo.toml:

[dependencies]
num-traits = "0.1"

and this to your crate root:

extern crate num_traits;

Compatibility

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