Rename Natural to Integer
'Natural' normally means 'positive integer' in mathematics. It is therefore strange to implement it on signed integer types. 'Integer' is probably a better choice.
This commit is contained in:
parent
d4868ee740
commit
024bf2ec72
|
@ -103,7 +103,8 @@ pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
|
|||
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
|
||||
pub use iter::{ExtendedMutableIter};
|
||||
|
||||
pub use num::{Num, Signed, Unsigned, Natural, NumCast};
|
||||
pub use num::{Num, NumCast};
|
||||
pub use num::{Signed, Unsigned, Integer};
|
||||
pub use ptr::Ptr;
|
||||
pub use to_str::ToStr;
|
||||
pub use clone::Clone;
|
||||
|
|
|
@ -279,7 +279,7 @@ impl Signed for T {
|
|||
fn is_negative(&self) -> bool { *self < 0 }
|
||||
}
|
||||
|
||||
impl Natural for T {
|
||||
impl Integer for T {
|
||||
/**
|
||||
* Floored integer division
|
||||
*
|
||||
|
|
|
@ -61,7 +61,7 @@ pub fn abs<T:Ord + Zero + Neg<T>>(v: T) -> T {
|
|||
if v < Zero::zero() { v.neg() } else { v }
|
||||
}
|
||||
|
||||
pub trait Natural: Num
|
||||
pub trait Integer: Num
|
||||
+ Ord
|
||||
+ Quot<Self,Self>
|
||||
+ Rem<Self,Self> {
|
||||
|
|
|
@ -176,7 +176,7 @@ impl Neg<T> for T {
|
|||
|
||||
impl Unsigned for T {}
|
||||
|
||||
impl Natural for T {
|
||||
impl Integer for T {
|
||||
/// Unsigned integer division. Returns the same result as `quot` (`/`).
|
||||
#[inline(always)]
|
||||
fn div(&self, other: T) -> T { *self / other }
|
||||
|
|
|
@ -37,7 +37,8 @@ pub use hash::Hash;
|
|||
pub use iter::{BaseIter, ReverseIter, MutableIter, ExtendedIter, EqIter};
|
||||
pub use iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
|
||||
pub use iter::{Times, ExtendedMutableIter};
|
||||
pub use num::{Num, Signed, Unsigned, Natural, NumCast};
|
||||
pub use num::{Num, NumCast};
|
||||
pub use num::{Signed, Unsigned, Integer};
|
||||
pub use path::GenericPath;
|
||||
pub use path::Path;
|
||||
pub use path::PosixPath;
|
||||
|
|
Loading…
Reference in New Issue