Skip to content

Commit df46c59

Browse files
committed
Relax constraint on closure for map* methods
1 parent df55183 commit df46c59

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/impl_methods.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,8 +1739,8 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
17391739
/// [1., 2.]])
17401740
/// );
17411741
/// ```
1742-
pub fn mapv<B, F>(&self, f: F) -> Array<B, D>
1743-
where F: Fn(A) -> B,
1742+
pub fn mapv<B, F>(&self, mut f: F) -> Array<B, D>
1743+
where F: FnMut(A) -> B,
17441744
A: Clone,
17451745
{
17461746
self.map(move |x| f(x.clone()))
@@ -1752,7 +1752,7 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
17521752
/// Elements are visited in arbitrary order.
17531753
pub fn mapv_into<F>(mut self, f: F) -> Self
17541754
where S: DataMut,
1755-
F: Fn(A) -> A,
1755+
F: FnMut(A) -> A,
17561756
A: Clone,
17571757
{
17581758
self.mapv_inplace(f);
@@ -1764,7 +1764,7 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
17641764
/// Elements are visited in arbitrary order.
17651765
pub fn map_inplace<F>(&mut self, f: F)
17661766
where S: DataMut,
1767-
F: Fn(&mut A),
1767+
F: FnMut(&mut A),
17681768
{
17691769
self.unordered_foreach_mut(f);
17701770
}
@@ -1785,9 +1785,9 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
17851785
/// [0.36788, 7.38906]]), 1e-5)
17861786
/// );
17871787
/// ```
1788-
pub fn mapv_inplace<F>(&mut self, f: F)
1788+
pub fn mapv_inplace<F>(&mut self, mut f: F)
17891789
where S: DataMut,
1790-
F: Fn(A) -> A,
1790+
F: FnMut(A) -> A,
17911791
A: Clone,
17921792
{
17931793
self.unordered_foreach_mut(move |x| *x = f(x.clone()));

0 commit comments

Comments
 (0)