Skip to content

Instantly share code, notes, and snippets.

@fengjian
Created June 7, 2020 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fengjian/7ac87efdb2723d88b2d167012a97dd4c to your computer and use it in GitHub Desktop.
Save fengjian/7ac87efdb2723d88b2d167012a97dd4c to your computer and use it in GitHub Desktop.
fn process<I, T>(container: I)
where
T: std::fmt::Display,
I: IntoIterator<Item=T>
{
for data in container {
println!("{}", data);
}
}
fn main() {
let v = vec![1,2,3];
process(&v);
}
@netcan
Copy link

netcan commented Jun 7, 2020

fn process<I, T>(container: &I)编译不过去。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment