Skip to content

Commit 024bf2e

Browse files
committed
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.
1 parent d4868ee commit 024bf2e

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

src/libcore/core.rc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
103103
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
104104
pub use iter::{ExtendedMutableIter};
105105

106-
pub use num::{Num, Signed, Unsigned, Natural, NumCast};
106+
pub use num::{Num, NumCast};
107+
pub use num::{Signed, Unsigned, Integer};
107108
pub use ptr::Ptr;
108109
pub use to_str::ToStr;
109110
pub use clone::Clone;

src/libcore/num/int-template.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl Signed for T {
279279
fn is_negative(&self) -> bool { *self < 0 }
280280
}
281281
282-
impl Natural for T {
282+
impl Integer for T {
283283
/**
284284
* Floored integer division
285285
*

src/libcore/num/num.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn abs<T:Ord + Zero + Neg<T>>(v: T) -> T {
6161
if v < Zero::zero() { v.neg() } else { v }
6262
}
6363

64-
pub trait Natural: Num
64+
pub trait Integer: Num
6565
+ Ord
6666
+ Quot<Self,Self>
6767
+ Rem<Self,Self> {

src/libcore/num/uint-template.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl Neg<T> for T {
176176
177177
impl Unsigned for T {}
178178
179-
impl Natural for T {
179+
impl Integer for T {
180180
/// Unsigned integer division. Returns the same result as `quot` (`/`).
181181
#[inline(always)]
182182
fn div(&self, other: T) -> T { *self / other }

src/libcore/prelude.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ pub use hash::Hash;
3737
pub use iter::{BaseIter, ReverseIter, MutableIter, ExtendedIter, EqIter};
3838
pub use iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
3939
pub use iter::{Times, ExtendedMutableIter};
40-
pub use num::{Num, Signed, Unsigned, Natural, NumCast};
40+
pub use num::{Num, NumCast};
41+
pub use num::{Signed, Unsigned, Integer};
4142
pub use path::GenericPath;
4243
pub use path::Path;
4344
pub use path::PosixPath;

0 commit comments

Comments
 (0)