Skip to content

Commit d0ea366

Browse files
committed
---
yaml --- r: 64669 b: refs/heads/snap-stage3 c: a0f8540 h: refs/heads/master i: 64667: f2637ba v: v3
1 parent 505e423 commit d0ea366

File tree

5 files changed

+32
-2
lines changed

5 files changed

+32
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e75ec8015701d4a43ec2644dbbc4a2e051c4f515
4+
refs/heads/snap-stage3: a0f8540c9571dadb9af542799156cc8a96263c41
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/num/bigint.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,11 @@ impl Ord for Sign {
732732
}
733733
}
734734

735+
impl TotalEq for Sign {
736+
fn equals(&self, other: &Sign) -> bool {
737+
*self == *other
738+
}
739+
}
735740
impl TotalOrd for Sign {
736741

737742
fn cmp(&self, other: &Sign) -> Ordering {

branches/snap-stage3/src/libextra/num/rational.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,25 @@ cmp_impl!(impl TotalEq, equals)
110110
cmp_impl!(impl Ord, lt, gt, le, ge)
111111
cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering)
112112

113+
impl<T: Clone + Integer + Ord> Orderable for Ratio<T> {
114+
#[inline]
115+
fn min(&self, other: &Ratio<T>) -> Ratio<T> {
116+
if *self < *other { self.clone() } else { other.clone() }
117+
}
118+
119+
#[inline]
120+
fn max(&self, other: &Ratio<T>) -> Ratio<T> {
121+
if *self > *other { self.clone() } else { other.clone() }
122+
}
123+
124+
#[inline]
125+
fn clamp(&self, mn: &Ratio<T>, mx: &Ratio<T>) -> Ratio<T> {
126+
if *self > *mx { mx.clone()} else
127+
if *self < *mn { mn.clone() } else { self.clone() }
128+
}
129+
}
130+
131+
113132
/* Arithmetic */
114133
// a/b * c/d = (a*c)/(b*d)
115134
impl<T: Clone + Integer + Ord>

branches/snap-stage3/src/libstd/cmp.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ pub trait TotalOrd: TotalEq {
8686
fn cmp(&self, other: &Self) -> Ordering;
8787
}
8888

89+
impl TotalEq for Ordering {
90+
#[inline]
91+
fn equals(&self, other: &Ordering) -> bool {
92+
*self == *other
93+
}
94+
}
8995
impl TotalOrd for Ordering {
9096
#[inline]
9197
fn cmp(&self, other: &Ordering) -> Ordering {

branches/snap-stage3/src/libstd/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<A, T: DoubleEndedIterator<A>> Iterator<A> for InvertIterator<A, T> {
8686
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
8787
}
8888

89-
impl<A, T: Iterator<A>> DoubleEndedIterator<A> for InvertIterator<A, T> {
89+
impl<A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for InvertIterator<A, T> {
9090
#[inline]
9191
fn next_back(&mut self) -> Option<A> { self.iter.next() }
9292
}

0 commit comments

Comments
 (0)