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:
Brendan Zabarauskas 2013-04-24 22:45:57 +10:00
parent d4868ee740
commit 024bf2ec72
5 changed files with 7 additions and 5 deletions

View File

@ -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;

View File

@ -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
*

View File

@ -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> {

View File

@ -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 }

View File

@ -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;