Skip to content

Commit 2064ba8

Browse files
committed
Update for Ord changes
1 parent 7c94c20 commit 2064ba8

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/types/range.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub enum BoundType {
172172
/// Represents a one-sided bound.
173173
///
174174
/// The side is determined by the `S` phantom parameter.
175-
#[deriving(Eq,Clone)]
175+
#[deriving(Clone)]
176176
pub struct RangeBound<S, T> {
177177
/// The value of the bound
178178
value: T,
@@ -200,6 +200,12 @@ impl<S: BoundSided, T: fmt::Show> fmt::Show for RangeBound<S, T> {
200200
}
201201
}
202202

203+
impl<S: BoundSided, T: Eq> Eq for RangeBound<S, T> {
204+
fn eq(&self, other: &RangeBound<S, T>) -> bool {
205+
self.value == other.value && self.type_ == other.type_
206+
}
207+
}
208+
203209
impl<S: BoundSided, T: Ord> Ord for RangeBound<S, T> {
204210
fn lt(&self, other: &RangeBound<S, T>) -> bool {
205211
match (BoundSided::side(None::<S>), self.type_, other.type_) {
@@ -229,6 +235,13 @@ impl<S: BoundSided, T: Ord> RangeBound<S, T> {
229235

230236
struct OptBound<'a, S, T>(Option<&'a RangeBound<S, T>>);
231237

238+
impl<'a, S: BoundSided, T: Eq> Eq for OptBound<'a, S, T> {
239+
fn eq(&self, &OptBound(ref other): &OptBound<'a, S, T>) -> bool {
240+
let &OptBound(ref self_) = self;
241+
self_ == other
242+
}
243+
}
244+
232245
impl<'a, S: BoundSided, T: Ord> Ord for OptBound<'a, S, T> {
233246
fn lt(&self, other: &OptBound<'a, S, T>) -> bool {
234247
match (*self, *other) {

0 commit comments

Comments
 (0)