Guest User

Untitled

a guest
Oct 18th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. use std::fmt::Debug;
  2.  
  3. fn foo() -> Vec<u32> {
  4. let mut xs = Vec::new();
  5. xs.push(8u32);
  6. xs.iter().map(|x| x * x).collect()
  7. }
  8.  
  9. fn bar<T: Copy + Debug>(x: T) -> Vec<(T,T)> {
  10. let mut xs = Vec::new();
  11. xs.push(x);
  12. xs.iter().map(|&x| (x, x)).collect()
  13. }
  14.  
  15. fn main() {
  16. println!("{:?}", foo());
  17. println!("{:?}", bar(()));
  18. }
Add Comment
Please, Sign In to add comment