@@ -15,6 +15,7 @@ use rawpointer::PointerExt;
1515use crate :: imp_prelude:: * ;
1616
1717use crate :: { arraytraits, DimMax } ;
18+ use crate :: argument_traits:: AssignElem ;
1819use crate :: dimension;
1920use crate :: dimension:: IntoDimension ;
2021use crate :: dimension:: {
@@ -25,7 +26,7 @@ use crate::dimension::broadcast::co_broadcast;
2526use crate :: error:: { self , ErrorKind , ShapeError , from_kind} ;
2627use crate :: math_cell:: MathCell ;
2728use crate :: itertools:: zip;
28- use crate :: zip:: Zip ;
29+ use crate :: zip:: { IntoNdProducer , Zip } ;
2930use crate :: AxisDescription ;
3031
3132use crate :: iter:: {
@@ -2049,6 +2050,23 @@ where
20492050 self . zip_mut_with ( rhs, |x, y| * x = y. clone ( ) ) ;
20502051 }
20512052
2053+ /// Perform an elementwise assigment of values cloned from `self` into array or producer `to`.
2054+ ///
2055+ /// The destination `to` can be another array or a producer of assignable elements.
2056+ /// [`AssignElem`] determines how elements are assigned.
2057+ ///
2058+ /// **Panics** if shapes disagree.
2059+ pub fn assign_to < P > ( & self , to : P )
2060+ where
2061+ S : Data ,
2062+ P : IntoNdProducer < Dim = D > ,
2063+ P :: Item : AssignElem < A > ,
2064+ A : Clone ,
2065+ {
2066+ Zip :: from ( self )
2067+ . map_assign_into ( to, A :: clone) ;
2068+ }
2069+
20522070 /// Perform an elementwise assigment to `self` from element `x`.
20532071 pub fn fill ( & mut self , x : A )
20542072 where
0 commit comments