@@ -532,12 +532,48 @@ pub struct ShareImage<T = Normal> {
532532 pub image : Point < T , Public , Zero > ,
533533}
534534
535- impl < T : PointType > PartialEq for ShareImage < T > {
535+ impl < T > PartialEq for ShareImage < T >
536+ where
537+ Point < T , Public , Zero > : PartialEq ,
538+ {
536539 fn eq ( & self , other : & Self ) -> bool {
537540 self . index == other. index && self . image == other. image
538541 }
539542}
540543
544+ impl < T > Eq for ShareImage < T > where Point < T , Public , Zero > : Eq { }
545+
546+ impl < T > PartialOrd for ShareImage < T >
547+ where
548+ Point < T , Public , Zero > : Ord ,
549+ {
550+ fn partial_cmp ( & self , other : & Self ) -> Option < core:: cmp:: Ordering > {
551+ Some ( self . cmp ( other) )
552+ }
553+ }
554+
555+ impl < T > Ord for ShareImage < T >
556+ where
557+ Point < T , Public , Zero > : Ord ,
558+ {
559+ fn cmp ( & self , other : & Self ) -> core:: cmp:: Ordering {
560+ match self . index . cmp ( & other. index ) {
561+ core:: cmp:: Ordering :: Equal => self . image . cmp ( & other. image ) ,
562+ ord => ord,
563+ }
564+ }
565+ }
566+
567+ impl < T > core:: hash:: Hash for ShareImage < T >
568+ where
569+ Point < T , Public , Zero > : core:: hash:: Hash ,
570+ {
571+ fn hash < H : core:: hash:: Hasher > ( & self , state : & mut H ) {
572+ self . index . hash ( state) ;
573+ self . image . hash ( state) ;
574+ }
575+ }
576+
541577#[ cfg( test) ]
542578mod test {
543579 use super :: * ;
0 commit comments