Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fmt::Debug;
- //consume x
- fn consume_print_return<T>(x: T) -> T
- where
- for<'a> &'a T: IntoIterator,
- for<'a> <&'a T as IntoIterator>::Item: Debug,
- {
- //print x
- for item in &x {
- println!("{:?}", item);
- }
- //return x
- x
- }
- fn main() {
- consume_print_return(vec![1, 2]);
- }
Add Comment
Please, Sign In to add comment