num-traits/src
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
..
ops Fix checked shift RHS to u32, drop from PrimInt 2018-01-13 15:02:38 +01:00
bounds.rs Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
cast.rs Include note for implementers of AsPrimitive 2018-01-14 21:23:19 +00:00
float.rs Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
identities.rs Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
int.rs Fix checked shift RHS to u32, drop from PrimInt 2018-01-13 15:02:38 +01:00
lib.rs std::fmt::Display implemented for ParseFloatError 2018-01-04 16:46:02 +03:00
pow.rs Move num-traits to its own repo 2017-12-18 17:35:41 -08:00
sign.rs Move num-traits to its own repo 2017-12-18 17:35:41 -08:00