File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
branches/incoming/src/libcore Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
- refs/heads/incoming: 161a82e433fbfbc0bd57a4d951ac37656a8a30f6
9
+ refs/heads/incoming: 5792244d03149fafdf65fc1bbc05b24323fbfa1a
10
10
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change 8
8
* type.
9
9
*/
10
10
11
+ use cmp:: Eq ;
12
+
11
13
/// The option type
12
14
enum Option < T > {
13
15
None ,
@@ -247,6 +249,25 @@ impl<T: copy> Option<T> {
247
249
pure fn while_some ( blk : fn ( +T ) -> Option < T > ) { while_some ( self , blk) }
248
250
}
249
251
252
+ impl < T : Eq > Option < T > : Eq {
253
+ pure fn eq ( & & other: Option < T > ) -> bool {
254
+ match self {
255
+ None => {
256
+ match other {
257
+ None => true ,
258
+ Some ( _) => false
259
+ }
260
+ }
261
+ Some ( self_contents) => {
262
+ match other {
263
+ None => false ,
264
+ Some ( other_contents) => self_contents. eq ( other_contents)
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
270
+
250
271
#[ test]
251
272
fn test_unwrap_ptr ( ) {
252
273
let x = ~0 ;
You can’t perform that action at this time.
0 commit comments