Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fmt::Debug;
- fn foo() -> Vec<u32> {
- let mut xs = Vec::new();
- xs.push(8u32);
- xs.iter().map(|x| x * x).collect()
- }
- fn bar<T: Copy + Debug>(x: T) -> Vec<(T,T)> {
- let mut xs = Vec::new();
- xs.push(x);
- xs.iter().map(|&x| (x, x)).collect()
- }
- fn main() {
- println!("{:?}", foo());
- println!("{:?}", bar(()));
- }
Add Comment
Please, Sign In to add comment