diff options
| author | bors <bors@rust-lang.org> | 2013-04-23 22:12:47 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-04-23 22:12:47 -0700 |
| commit | c8ac057545f7b2edf1e488aa4562138a6ed7a096 (patch) | |
| tree | 4c67cea5512e5f0cceeda17b3f2b905c4202bd36 /src/libstd/priority_queue.rs | |
| parent | 706096b31960143fb1eb957a882f170ae4a8b4e9 (diff) | |
| parent | ab8068c9f2cbcce4411020b04dafe2055044f96a (diff) | |
| download | rust-c8ac057545f7b2edf1e488aa4562138a6ed7a096.tar.gz rust-c8ac057545f7b2edf1e488aa4562138a6ed7a096.zip | |
auto merge of #6041 : bjz/rust/numeric-traits, r=brson
As part of the numeric trait reform (see issue #4819), I have added the following traits to `core::num` and implemented them for the appropriate types:
~~~rust
pub trait Signed: Num
+ Neg<Self> {
fn abs(&self) -> Self;
fn signum(&self) -> Self;
fn is_positive(&self) -> bool;
fn is_negative(&self) -> bool;
}
pub trait Unsigned: Num {}
pub trait Natural: Num
+ Ord
+ Quot<Self,Self>
+ Rem<Self,Self> {
fn div(&self, other: Self) -> Self;
fn modulo(&self, other: Self) -> Self;
fn div_mod(&self, other: Self) -> (Self,Self);
fn quot_rem(&self, other: Self) -> (Self,Self);
fn gcd(&self, other: Self) -> Self;
fn lcm(&self, other: Self) -> Self;
fn divisible_by(&self, other: Self) -> bool;
fn is_even(&self) -> bool;
fn is_odd(&self) -> bool;
}
~~~
I have not implemented `Natural` for `BigInt` and `BigUInt` because they're a little over my head. Help with this would be most appreciated.
Diffstat (limited to 'src/libstd/priority_queue.rs')
0 files changed, 0 insertions, 0 deletions
