@@ -2582,6 +2582,37 @@ impl<T: ?Sized> fmt::Pointer for NonNull<T> {
2582
2582
}
2583
2583
}
2584
2584
2585
+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2586
+ impl < T : ?Sized > Eq for NonNull < T > { }
2587
+
2588
+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2589
+ impl < T : ?Sized > PartialEq for NonNull < T > {
2590
+ fn eq ( & self , other : & Self ) -> bool {
2591
+ self . as_ptr ( ) == other. as_ptr ( )
2592
+ }
2593
+ }
2594
+
2595
+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2596
+ impl < T : ?Sized > Ord for NonNull < T > {
2597
+ fn cmp ( & self , other : & Self ) -> Ordering {
2598
+ self . as_ptr ( ) . cmp ( & other. as_ptr ( ) )
2599
+ }
2600
+ }
2601
+
2602
+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2603
+ impl < T : ?Sized > PartialOrd for NonNull < T > {
2604
+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
2605
+ self . as_ptr ( ) . partial_cmp ( & other. as_ptr ( ) )
2606
+ }
2607
+ }
2608
+
2609
+ #[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2610
+ impl < T : ?Sized > hash:: Hash for NonNull < T > {
2611
+ fn hash < H : hash:: Hasher > ( & self , state : & mut H ) {
2612
+ self . as_ptr ( ) . hash ( state)
2613
+ }
2614
+ }
2615
+
2585
2616
#[ stable( feature = "nonnull" , since = "1.25.0" ) ]
2586
2617
impl < T : ?Sized > From < Unique < T > > for NonNull < T > {
2587
2618
fn from ( unique : Unique < T > ) -> Self {
0 commit comments