@@ -671,6 +671,7 @@ where
671
671
672
672
macro_rules! arith_scalar_func {
673
673
( $rust_type: ty, $op_name: ident, $fn_name: ident) => {
674
+ // Implement (&Array<T> op_name rust_type)
674
675
impl <' f, T > $op_name<$rust_type> for & ' f Array <T >
675
676
where
676
677
T : HasAfEnum + ImplicitPromote <$rust_type>,
@@ -685,6 +686,7 @@ macro_rules! arith_scalar_func {
685
686
}
686
687
}
687
688
689
+ // Implement (Array<T> op_name rust_type)
688
690
impl <T : HasAfEnum > $op_name<$rust_type> for Array <T >
689
691
where
690
692
T : HasAfEnum + ImplicitPromote <$rust_type>,
@@ -698,6 +700,34 @@ macro_rules! arith_scalar_func {
698
700
$fn_name( & self , & temp, false )
699
701
}
700
702
}
703
+
704
+ // Implement (rust_type op_name &Array<T>)
705
+ impl <' f, T > $op_name<& ' f Array <T >> for $rust_type
706
+ where
707
+ T : HasAfEnum + ImplicitPromote <$rust_type>,
708
+ $rust_type: HasAfEnum + ImplicitPromote <T >,
709
+ <$rust_type as ImplicitPromote <T >>:: Output : HasAfEnum ,
710
+ {
711
+ type Output = Array <<$rust_type as ImplicitPromote <T >>:: Output >;
712
+
713
+ fn $fn_name( self , rhs: & ' f Array <T >) -> Self :: Output {
714
+ $fn_name( & self , rhs, false )
715
+ }
716
+ }
717
+
718
+ // Implement (rust_type op_name Array<T>)
719
+ impl <T > $op_name<Array <T >> for $rust_type
720
+ where
721
+ T : HasAfEnum + ImplicitPromote <$rust_type>,
722
+ $rust_type: HasAfEnum + ImplicitPromote <T >,
723
+ <$rust_type as ImplicitPromote <T >>:: Output : HasAfEnum ,
724
+ {
725
+ type Output = Array <<$rust_type as ImplicitPromote <T >>:: Output >;
726
+
727
+ fn $fn_name( self , rhs: Array <T >) -> Self :: Output {
728
+ $fn_name( & self , & rhs, false )
729
+ }
730
+ }
701
731
} ;
702
732
}
703
733
0 commit comments