Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unused)]
- struct Foo {
- vector: Vec<i32>,
- }
- fn main() {
- let v1 = vec![1, 2, 3, 4];
- let v2 = v1.into_iter().map(|num| num + 1).collect();
- // enabling below code will require type anottation of v2.
- //println!("v2 len: {}", v2.len());
- let _foo = Foo {
- vector: v2, // I thick compiler can determine type of v2 here.
- };
- }
Add Comment
Please, Sign In to add comment