@@ -15,6 +15,7 @@ use rawpointer::PointerExt;
15
15
use crate :: imp_prelude:: * ;
16
16
17
17
use crate :: { arraytraits, DimMax } ;
18
+ use crate :: argument_traits:: AssignElem ;
18
19
use crate :: dimension;
19
20
use crate :: dimension:: IntoDimension ;
20
21
use crate :: dimension:: {
@@ -25,7 +26,7 @@ use crate::dimension::broadcast::co_broadcast;
25
26
use crate :: error:: { self , ErrorKind , ShapeError , from_kind} ;
26
27
use crate :: math_cell:: MathCell ;
27
28
use crate :: itertools:: zip;
28
- use crate :: zip:: Zip ;
29
+ use crate :: zip:: { IntoNdProducer , Zip } ;
29
30
use crate :: AxisDescription ;
30
31
31
32
use crate :: iter:: {
@@ -2049,6 +2050,23 @@ where
2049
2050
self . zip_mut_with ( rhs, |x, y| * x = y. clone ( ) ) ;
2050
2051
}
2051
2052
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
+
2052
2070
/// Perform an elementwise assigment to `self` from element `x`.
2053
2071
pub fn fill ( & mut self , x : A )
2054
2072
where
0 commit comments