@@ -54,13 +54,13 @@ fn test_azip2_3() {
54
54
fn test_zip_collect ( ) {
55
55
use approx:: assert_abs_diff_eq;
56
56
57
- // test Zip::apply_collect and that it preserves c/f layout.
57
+ // test Zip::map_collect and that it preserves c/f layout.
58
58
59
59
let b = Array :: from_shape_fn ( ( 5 , 10 ) , |( i, j) | 1. / ( i + 2 * j + 1 ) as f32 ) ;
60
60
let c = Array :: from_shape_fn ( ( 5 , 10 ) , |( i, j) | f32:: exp ( ( i + j) as f32 ) ) ;
61
61
62
62
{
63
- let a = Zip :: from ( & b) . and ( & c) . apply_collect ( |x, y| x + y) ;
63
+ let a = Zip :: from ( & b) . and ( & c) . map_collect ( |x, y| x + y) ;
64
64
65
65
assert_abs_diff_eq ! ( a, & b + & c, epsilon = 1e-6 ) ;
66
66
assert_eq ! ( a. strides( ) , b. strides( ) ) ;
@@ -70,7 +70,7 @@ fn test_zip_collect() {
70
70
let b = b. t ( ) ;
71
71
let c = c. t ( ) ;
72
72
73
- let a = Zip :: from ( & b) . and ( & c) . apply_collect ( |x, y| x + y) ;
73
+ let a = Zip :: from ( & b) . and ( & c) . map_collect ( |x, y| x + y) ;
74
74
75
75
assert_abs_diff_eq ! ( a, & b + & c, epsilon = 1e-6 ) ;
76
76
assert_eq ! ( a. strides( ) , b. strides( ) ) ;
@@ -86,7 +86,7 @@ fn test_zip_assign_into() {
86
86
let b = Array :: from_shape_fn ( ( 5 , 10 ) , |( i, j) | 1. / ( i + 2 * j + 1 ) as f32 ) ;
87
87
let c = Array :: from_shape_fn ( ( 5 , 10 ) , |( i, j) | f32:: exp ( ( i + j) as f32 ) ) ;
88
88
89
- Zip :: from ( & b) . and ( & c) . apply_assign_into ( & mut a, |x, y| x + y) ;
89
+ Zip :: from ( & b) . and ( & c) . map_assign_into ( & mut a, |x, y| x + y) ;
90
90
91
91
assert_abs_diff_eq ! ( a, & b + & c, epsilon = 1e-6 ) ;
92
92
}
@@ -101,7 +101,7 @@ fn test_zip_assign_into_cell() {
101
101
let b = Array :: from_shape_fn ( ( 5 , 10 ) , |( i, j) | 1. / ( i + 2 * j + 1 ) as f32 ) ;
102
102
let c = Array :: from_shape_fn ( ( 5 , 10 ) , |( i, j) | f32:: exp ( ( i + j) as f32 ) ) ;
103
103
104
- Zip :: from ( & b) . and ( & c) . apply_assign_into ( & a, |x, y| x + y) ;
104
+ Zip :: from ( & b) . and ( & c) . map_assign_into ( & a, |x, y| x + y) ;
105
105
let a2 = a. mapv ( |elt| elt. get ( ) ) ;
106
106
107
107
assert_abs_diff_eq ! ( a2, & b + & c, epsilon = 1e-6 ) ;
@@ -154,7 +154,7 @@ fn test_zip_collect_drop() {
154
154
}
155
155
156
156
let _result = panic:: catch_unwind ( panic:: AssertUnwindSafe ( || {
157
- Zip :: from ( & a) . and ( & b) . apply_collect ( |& elt, _| {
157
+ Zip :: from ( & a) . and ( & b) . map_collect ( |& elt, _| {
158
158
if elt. 0 > 3 && will_panic {
159
159
panic ! ( ) ;
160
160
}
@@ -308,7 +308,7 @@ fn test_indices_0() {
308
308
let a1 = arr0 ( 3 ) ;
309
309
310
310
let mut count = 0 ;
311
- Zip :: indexed ( & a1) . apply ( |i, elt| {
311
+ Zip :: indexed ( & a1) . for_each ( |i, elt| {
312
312
count += 1 ;
313
313
assert_eq ! ( i, ( ) ) ;
314
314
assert_eq ! ( * elt, 3 ) ;
0 commit comments