@@ -56,6 +56,7 @@ use core::ptr::{NonNull, Pointee, DynMetadata};
56
56
use core:: marker:: { PhantomData , Unsize } ;
57
57
use core:: hash:: { Hash , Hasher } ;
58
58
use core:: fmt:: { self , Debug , Formatter } ;
59
+ use core:: cmp:: Ordering ;
59
60
60
61
use zerogc_derive:: unsafe_gc_impl;
61
62
pub use zerogc_derive:: { Trace , NullTrace } ;
@@ -835,13 +836,39 @@ impl<'gc, T: GcSafe<'gc, Id> + PartialEq + 'gc, Id: CollectorId> PartialEq for G
835
836
// NOTE: We compare by value, not identity
836
837
self . value ( ) == other. value ( )
837
838
}
839
+ #[ inline]
840
+ fn ne ( & self , other : & Self ) -> bool {
841
+ self . value ( ) != other. value ( )
842
+ }
838
843
}
839
844
impl < ' gc , T : GcSafe < ' gc , Id > + Eq + ' gc , Id : CollectorId > Eq for Gc < ' gc , T , Id > { }
840
845
impl < ' gc , T : GcSafe < ' gc , Id > + PartialEq + ' gc , Id : CollectorId > PartialEq < T > for Gc < ' gc , T , Id > {
841
846
#[ inline]
842
847
fn eq ( & self , other : & T ) -> bool {
843
848
self . value ( ) == other
844
849
}
850
+ #[ inline]
851
+ fn ne ( & self , other : & T ) -> bool {
852
+ self . value ( ) != other
853
+ }
854
+ }
855
+ impl < ' gc , T : GcSafe < ' gc , Id > + PartialOrd + ' gc , Id : CollectorId > PartialOrd for Gc < ' gc , T , Id > {
856
+ #[ inline]
857
+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
858
+ self . value ( ) . partial_cmp ( other. value ( ) )
859
+ }
860
+ }
861
+ impl < ' gc , T : GcSafe < ' gc , Id > + PartialOrd + ' gc , Id : CollectorId > PartialOrd < T > for Gc < ' gc , T , Id > {
862
+ #[ inline]
863
+ fn partial_cmp ( & self , other : & T ) -> Option < Ordering > {
864
+ self . value ( ) . partial_cmp ( other)
865
+ }
866
+ }
867
+ impl < ' gc , T : GcSafe < ' gc , Id > + Ord + ' gc , Id : CollectorId > Ord for Gc < ' gc , T , Id > {
868
+ #[ inline]
869
+ fn cmp ( & self , other : & Self ) -> Ordering {
870
+ self . value ( ) . cmp ( other)
871
+ }
845
872
}
846
873
impl < ' gc , T : GcSafe < ' gc , Id > + Debug + ' gc , Id : CollectorId > Debug for Gc < ' gc , T , Id > {
847
874
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
0 commit comments