diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2013-04-26 19:56:11 +1000 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2013-04-26 19:56:11 +1000 |
| commit | 6efbbf2e1481c3f42d7bd1cd7008fdc54939d9d3 (patch) | |
| tree | c229ca5c81f0a066d2ee05ada4f49aee3bfce41c /src/libcore/num | |
| parent | faaf3bf1495a8d76e822981544de2b346346d91d (diff) | |
| download | rust-6efbbf2e1481c3f42d7bd1cd7008fdc54939d9d3.tar.gz rust-6efbbf2e1481c3f42d7bd1cd7008fdc54939d9d3.zip | |
Combine PrimitiveInt, Int, and Uint traits into one single trait
Having three traits for primitive ints/uints seemed rather excessive. If users wish to specify between them they can simply combine Int with either the Signed and Unsigned traits. For example: fn foo<T: Int + Signed>() { … }
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/int-template.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/num.rs | 22 | ||||
| -rw-r--r-- | src/libcore/num/uint-template.rs | 4 |
3 files changed, 6 insertions, 22 deletions
diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs index 11dacdd4493..0c126bd1de5 100644 --- a/src/libcore/num/int-template.rs +++ b/src/libcore/num/int-template.rs @@ -445,8 +445,6 @@ impl Bounded for T { fn max_value() -> T { max_value } } -impl PrimitiveInt for T {} - impl Int for T {} // String conversion functions and impl str -> num diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs index cec5fe8cd28..f1a77a4ed59 100644 --- a/src/libcore/num/num.rs +++ b/src/libcore/num/num.rs @@ -217,23 +217,11 @@ pub trait Primitive: Num /// /// A collection of traits relevant to primitive signed and unsigned integers /// -pub trait PrimitiveInt: Integer - + Primitive - + Bounded - + Bitwise - + BitCount {} - -/// -/// Specialisation of `PrimitiveInt` for unsigned integers -/// -pub trait Uint: PrimitiveInt - + Unsigned {} - -/// -/// Specialisation of `PrimitiveInt` for signed integers -/// -pub trait Int: PrimitiveInt - + Signed {} +pub trait Int: Integer + + Primitive + + Bounded + + Bitwise + + BitCount {} /// /// Primitive floating point numbers. This trait should only be implemented diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs index 2e6c7e28b18..d84f4a99d53 100644 --- a/src/libcore/num/uint-template.rs +++ b/src/libcore/num/uint-template.rs @@ -277,9 +277,7 @@ impl Bounded for T { fn max_value() -> T { max_value } } -impl PrimitiveInt for T {} - -impl Uint for T {} +impl Int for T {} // String conversion functions and impl str -> num |
