@@ -969,15 +969,9 @@ macro_rules! map_impl {
969
969
pub fn and<P >( self , p: P ) -> Zip <( $( $p, ) * P :: Output , ) , D >
970
970
where P : IntoNdProducer <Dim =D >,
971
971
{
972
- let array = p. into_producer( ) ;
973
- self . check( & array) ;
974
- let part_layout = array. layout( ) ;
975
- let ( $( $p, ) * ) = self . parts;
976
- Zip {
977
- parts: ( $( $p, ) * array, ) ,
978
- layout: self . layout. and( part_layout) ,
979
- dimension: self . dimension,
980
- }
972
+ let part = p. into_producer( ) ;
973
+ self . check( & part) ;
974
+ self . build_and( part)
981
975
}
982
976
983
977
/// Include the producer `p` in the Zip, broadcasting if needed.
@@ -990,11 +984,17 @@ macro_rules! map_impl {
990
984
where P : IntoNdProducer <Dim =D2 , Output =ArrayView <' a, Elem , D2 >, Item =& ' a Elem >,
991
985
D2 : Dimension ,
992
986
{
993
- let array = p. into_producer( ) . broadcast_unwrap( self . dimension. clone( ) ) ;
994
- let part_layout = array. layout( ) ;
987
+ let part = p. into_producer( ) . broadcast_unwrap( self . dimension. clone( ) ) ;
988
+ self . build_and( part)
989
+ }
990
+
991
+ fn build_and<P >( self , part: P ) -> Zip <( $( $p, ) * P , ) , D >
992
+ where P : NdProducer <Dim =D >,
993
+ {
994
+ let part_layout = part. layout( ) ;
995
995
let ( $( $p, ) * ) = self . parts;
996
996
Zip {
997
- parts: ( $( $p, ) * array , ) ,
997
+ parts: ( $( $p, ) * part , ) ,
998
998
layout: self . layout. and( part_layout) ,
999
999
dimension: self . dimension,
1000
1000
}
0 commit comments