File tree 2 files changed +2
-24
lines changed
2 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -21,24 +21,11 @@ Similar to a mutable option type, but friendlier.
21
21
*/
22
22
23
23
#[ mutable]
24
- #[ deriving( Clone ) ]
24
+ #[ deriving( Clone , DeepClone , Eq ) ]
25
25
pub struct Cell < T > {
26
26
priv value : Option < T >
27
27
}
28
28
29
- impl < T : DeepClone > DeepClone for Cell < T > {
30
- fn deep_clone ( & self ) -> Cell < T > {
31
- Cell { value : self . value . deep_clone ( ) }
32
- }
33
- }
34
-
35
- impl < T : cmp:: Eq > cmp:: Eq for Cell < T > {
36
- fn eq ( & self , other : & Cell < T > ) -> bool {
37
- ( self . value ) == ( other. value )
38
- }
39
- fn ne ( & self , other : & Cell < T > ) -> bool { !self . eq ( other) }
40
- }
41
-
42
29
/// Creates a new full cell with the given value.
43
30
pub fn Cell < T > ( value : T ) -> Cell < T > {
44
31
Cell { value : Some ( value) }
Original file line number Diff line number Diff line change @@ -54,21 +54,12 @@ use clone::DeepClone;
54
54
#[ cfg( test) ] use str;
55
55
56
56
/// The option type
57
- #[ deriving( Clone , Eq ) ]
57
+ #[ deriving( Clone , DeepClone , Eq ) ]
58
58
pub enum Option < T > {
59
59
None ,
60
60
Some ( T ) ,
61
61
}
62
62
63
- impl < T : DeepClone > DeepClone for Option < T > {
64
- fn deep_clone ( & self ) -> Option < T > {
65
- match * self {
66
- Some ( ref x) => Some ( x. deep_clone ( ) ) ,
67
- None => None
68
- }
69
- }
70
- }
71
-
72
63
impl < T : Ord > Ord for Option < T > {
73
64
fn lt ( & self , other : & Option < T > ) -> bool {
74
65
match ( self , other) {
You can’t perform that action at this time.
0 commit comments