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>() { … }
This commit is contained in:
parent
faaf3bf149
commit
6efbbf2e14
@ -107,8 +107,7 @@ pub use num::{Num, NumCast};
|
||||
pub use num::{Signed, Unsigned, Integer};
|
||||
pub use num::{Round, Fractional, Real, RealExt};
|
||||
pub use num::{Bitwise, BitCount, Bounded};
|
||||
pub use num::{Primitive, PrimitiveInt};
|
||||
pub use num::{Int, Uint, Float};
|
||||
pub use num::{Primitive, Int, Float};
|
||||
pub use ptr::Ptr;
|
||||
pub use to_str::ToStr;
|
||||
pub use clone::Clone;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -41,8 +41,7 @@ pub use num::{Num, NumCast};
|
||||
pub use num::{Signed, Unsigned, Integer};
|
||||
pub use num::{Round, Fractional, Real, RealExt};
|
||||
pub use num::{Bitwise, BitCount, Bounded};
|
||||
pub use num::{Primitive, PrimitiveInt};
|
||||
pub use num::{Int, Uint, Float};
|
||||
pub use num::{Primitive, Int, Float};
|
||||
pub use path::GenericPath;
|
||||
pub use path::Path;
|
||||
pub use path::PosixPath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user