Logo

Programming-Idioms

History of Idiom 19 > diff from v26 to v27

Edit summary for version 27 by programming-idioms.org:
[Rust] Comment emphasis

Version 26

2016-02-18, 17:20:20

Version 27

2016-11-29, 22:40:52

Idiom #19 Reverse a list

Reverse the order of the elements of list x .
This may reverse "in-place" and destroy the original ordering.

Idiom #19 Reverse a list

Reverse the order of the elements of list x .
This may reverse "in-place" and destroy the original ordering.

Code
let y: Vec<_> = x.iter().rev().collect();
Code
let y: Vec<_> = x.iter().rev().collect();
Comments bubble
Instead of `Vec`, you can also use any other data structure that implements `collect`.
Comments bubble
Instead of Vec, you can also use any other data structure that implements collect.
Demo URL
http://is.gd/kzJbJp
Demo URL
http://is.gd/kzJbJp