Guest User

Untitled

a guest
Dec 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #![allow(unused)]
  2. struct Foo {
  3. vector: Vec<i32>,
  4. }
  5.  
  6. fn main() {
  7. let v1 = vec![1, 2, 3, 4];
  8.  
  9. let v2 = v1.into_iter().map(|num| num + 1).collect();
  10.  
  11. // enabling below code will require type anottation of v2.
  12. //println!("v2 len: {}", v2.len());
  13.  
  14. let _foo = Foo {
  15. vector: v2, // I thick compiler can determine type of v2 here.
  16. };
  17. }
Add Comment
Please, Sign In to add comment