File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
experiments/2024-12-09/src/geometry Expand file tree Collapse file tree 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 } ;
22
33use super :: tri_mesh:: TriMesh ;
44
@@ -29,7 +29,6 @@ impl fmt::Display for OperationDisplay<'_> {
2929 }
3030}
3131
32- #[ derive( Ord , PartialOrd ) ]
3332pub struct Handle < T > {
3433 inner : Rc < T > ,
3534}
@@ -74,12 +73,24 @@ impl<T> Deref for Handle<T> {
7473
7574impl < T > Eq for Handle < T > { }
7675
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+
7782impl < T > PartialEq for Handle < T > {
7883 fn eq ( & self , other : & Self ) -> bool {
7984 Rc :: ptr_eq ( & self . inner , & other. inner )
8085 }
8186}
8287
88+ impl < T > PartialOrd for Handle < T > {
89+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
90+ Some ( self . cmp ( other) )
91+ }
92+ }
93+
8394impl < T > fmt:: Debug for Handle < T > {
8495 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8596 f. debug_struct ( "Handle" )
You can’t perform that action at this time.
0 commit comments