Go to file
bors[bot] aa7c15e0e9 Merge #17 #21
17: Add AsPrimitive trait for generic casting with `as` r=cuviper a=Enet4

This is my personal attempt at #7. It is fairly similar to what can be found in `asprim`, although implemented from scratch. Please let me know of what you think. Could it use more tests? Should I also leave a safety notice that some conversions with `as` are currently UB (rust-lang/rust#10184)? 


21: Add checked shifts r=cuviper a=fabianschuiki

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-18 05:37:47 +00:00
ci Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
src Merge #17 #21 2018-01-18 05:37:47 +00: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.