File tree 1 file changed +13
-2
lines changed
experiments/2024-12-09/src/geometry 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
- use std:: { fmt, ops:: Deref , rc:: Rc } ;
1
+ use std:: { cmp :: Ordering , fmt, ops:: Deref , rc:: Rc } ;
2
2
3
3
use super :: tri_mesh:: TriMesh ;
4
4
@@ -29,7 +29,6 @@ impl fmt::Display for OperationDisplay<'_> {
29
29
}
30
30
}
31
31
32
- #[ derive( Ord , PartialOrd ) ]
33
32
pub struct Handle < T > {
34
33
inner : Rc < T > ,
35
34
}
@@ -74,12 +73,24 @@ impl<T> Deref for Handle<T> {
74
73
75
74
impl < T > Eq for Handle < T > { }
76
75
76
+ impl < T > Ord for Handle < T > {
77
+ fn cmp ( & self , other : & Self ) -> Ordering {
78
+ Rc :: as_ptr ( & self . inner ) . cmp ( & Rc :: as_ptr ( & other. inner ) )
79
+ }
80
+ }
81
+
77
82
impl < T > PartialEq for Handle < T > {
78
83
fn eq ( & self , other : & Self ) -> bool {
79
84
Rc :: ptr_eq ( & self . inner , & other. inner )
80
85
}
81
86
}
82
87
88
+ impl < T > PartialOrd for Handle < T > {
89
+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
90
+ Some ( self . cmp ( other) )
91
+ }
92
+ }
93
+
83
94
impl < T > fmt:: Debug for Handle < T > {
84
95
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
85
96
f. debug_struct ( "Handle" )
You can’t perform that action at this time.
0 commit comments