File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 12f6e868f7c52a1329b91e16143c0879ffe747e4
2
+ refs/heads/master: a6b2a2cdb1c93971ae5925ad312043754680180f
Original file line number Diff line number Diff line change @@ -384,7 +384,19 @@ Function: map
384
384
385
385
Apply a function to each element of a vector and return the results
386
386
*/
387
- fn map < copy T , U > ( f : block ( T ) -> U , v : [ const T ] ) -> [ U ] {
387
+ fn map < T , U > ( f : block ( T ) -> U , v : [ T ] ) -> [ U ] {
388
+ let result = [ ] ;
389
+ reserve ( result, len ( v) ) ;
390
+ for elem: T in v { result += [ f ( elem) ] ; }
391
+ ret result;
392
+ }
393
+
394
+ /*
395
+ Function: map_mut
396
+
397
+ Apply a function to each element of a mutable vector and return the results
398
+ */
399
+ fn map_mut < copy T , U > ( f : block ( T ) -> U , v : [ const T ] ) -> [ U ] {
388
400
let result = [ ] ;
389
401
reserve ( result, len ( v) ) ;
390
402
for elem: T in v {
You can’t perform that action at this time.
0 commit comments