diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2013-04-24 22:45:57 +1000 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2013-04-25 08:20:00 +1000 |
| commit | 024bf2ec72bdc2428d5c58a59bfed7da1bbc4efd (patch) | |
| tree | 7ba0a339d6bf55e5191e94c697823895279b967f /src/libcore | |
| parent | d4868ee74085c2dc2943ef9407ced2d06e43abf6 (diff) | |
| download | rust-024bf2ec72bdc2428d5c58a59bfed7da1bbc4efd.tar.gz rust-024bf2ec72bdc2428d5c58a59bfed7da1bbc4efd.zip | |
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.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/core.rc | 3 | ||||
| -rw-r--r-- | src/libcore/num/int-template.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/num.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/uint-template.rs | 2 | ||||
| -rw-r--r-- | src/libcore/prelude.rs | 3 |
5 files changed, 7 insertions, 5 deletions
diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 7890d611e85..2a8de6a8032 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -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; diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs index cb29b9e4486..e322e5edeb9 100644 --- a/src/libcore/num/int-template.rs +++ b/src/libcore/num/int-template.rs @@ -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 * diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs index 8304179c346..1c3c699603b 100644 --- a/src/libcore/num/num.rs +++ b/src/libcore/num/num.rs @@ -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> { diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs index 2ee64d4e4ea..69483f33e52 100644 --- a/src/libcore/num/uint-template.rs +++ b/src/libcore/num/uint-template.rs @@ -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 } diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index 0af0cdf08c9..ec332adb832 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -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; |
