@@ -30,12 +30,12 @@ pub trait Pos {
30
30
}
31
31
32
32
/// A byte offset
33
- #[ deriving( Clone , Eq , IterBytes ) ]
33
+ #[ deriving( Clone , Eq , IterBytes , Ord ) ]
34
34
pub struct BytePos ( uint ) ;
35
35
/// A character offset. Because of multibyte utf8 characters, a byte offset
36
36
/// is not equivalent to a character offset. The CodeMap will convert BytePos
37
37
/// values to CharPos values as necessary.
38
- #[ deriving( Eq , IterBytes ) ]
38
+ #[ deriving( Eq , IterBytes , Ord ) ]
39
39
pub struct CharPos ( uint ) ;
40
40
41
41
// XXX: Lots of boilerplate in these impls, but so far my attempts to fix
@@ -46,13 +46,6 @@ impl Pos for BytePos {
46
46
fn to_uint ( & self ) -> uint { * * self }
47
47
}
48
48
49
- impl cmp:: Ord for BytePos {
50
- fn lt ( & self , other : & BytePos ) -> bool { * * self < * * other }
51
- fn le ( & self , other : & BytePos ) -> bool { * * self <= * * other }
52
- fn ge ( & self , other : & BytePos ) -> bool { * * self >= * * other }
53
- fn gt ( & self , other : & BytePos ) -> bool { * * self > * * other }
54
- }
55
-
56
49
impl Add < BytePos , BytePos > for BytePos {
57
50
fn add ( & self , rhs : & BytePos ) -> BytePos {
58
51
BytePos ( * * self + * * rhs)
@@ -70,13 +63,6 @@ impl Pos for CharPos {
70
63
fn to_uint ( & self ) -> uint { * * self }
71
64
}
72
65
73
- impl cmp:: Ord for CharPos {
74
- fn lt ( & self , other : & CharPos ) -> bool { * * self < * * other }
75
- fn le ( & self , other : & CharPos ) -> bool { * * self <= * * other }
76
- fn ge ( & self , other : & CharPos ) -> bool { * * self >= * * other }
77
- fn gt ( & self , other : & CharPos ) -> bool { * * self > * * other }
78
- }
79
-
80
66
impl Add < CharPos , CharPos > for CharPos {
81
67
fn add ( & self , rhs : & CharPos ) -> CharPos {
82
68
CharPos ( * * self + * * rhs)
0 commit comments