@@ -12,38 +12,15 @@ use std::fmt;
12
12
// An Au is an "App Unit" and represents 1/60th of a CSS pixel. It was
13
13
// originally proposed in 2002 as a standard unit of measure in Gecko.
14
14
// See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info.
15
+ #[ deriving( Clone , Eq , Ord , Zero ) ]
15
16
pub struct Au ( pub i32 ) ;
16
17
17
- // We don't use #[deriving] here for inlining.
18
- impl Clone for Au {
19
- #[ inline]
20
- fn clone ( & self ) -> Au {
21
- let Au ( i) = * self ;
22
- Au ( i)
23
- }
24
- }
25
-
26
18
impl fmt:: Show for Au {
27
19
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
28
20
let Au ( n) = * self ;
29
21
write ! ( f. buf, "Au({})" , n)
30
22
} }
31
23
32
- impl Eq for Au {
33
- #[ inline]
34
- fn eq ( & self , other : & Au ) -> bool {
35
- let Au ( s) = * self ;
36
- let Au ( o) = * other;
37
- s == o
38
- }
39
- #[ inline]
40
- fn ne ( & self , other : & Au ) -> bool {
41
- let Au ( s) = * self ;
42
- let Au ( o) = * other;
43
- s != o
44
- }
45
- }
46
-
47
24
impl Add < Au , Au > for Au {
48
25
#[ inline]
49
26
fn add ( & self , other : & Au ) -> Au {
@@ -98,48 +75,11 @@ impl Neg<Au> for Au {
98
75
}
99
76
}
100
77
101
- impl Ord for Au {
102
- #[ inline]
103
- fn lt ( & self , other : & Au ) -> bool {
104
- let Au ( s) = * self ;
105
- let Au ( o) = * other;
106
- s < o
107
- }
108
- #[ inline]
109
- fn le ( & self , other : & Au ) -> bool {
110
- let Au ( s) = * self ;
111
- let Au ( o) = * other;
112
- s <= o
113
- }
114
- #[ inline]
115
- fn ge ( & self , other : & Au ) -> bool {
116
- let Au ( s) = * self ;
117
- let Au ( o) = * other;
118
- s >= o
119
- }
120
- #[ inline]
121
- fn gt ( & self , other : & Au ) -> bool {
122
- let Au ( s) = * self ;
123
- let Au ( o) = * other;
124
- s > o
125
- }
126
- }
127
-
128
78
impl One for Au {
129
79
#[ inline]
130
80
fn one ( ) -> Au { Au ( 1 ) }
131
81
}
132
82
133
- impl Zero for Au {
134
- #[ inline]
135
- fn zero ( ) -> Au { Au ( 0 ) }
136
- #[ inline]
137
- fn is_zero ( & self ) -> bool {
138
- let Au ( s) = * self ;
139
- s == 0
140
- }
141
- }
142
-
143
83
impl Num for Au { }
144
84
145
85
#[ inline]
0 commit comments