Skip to content

Instantly share code, notes, and snippets.

@RGGH
Created May 22, 2024 18:36
Show Gist options
  • Save RGGH/e19de4be8e8f8847cce6e5de3c874f29 to your computer and use it in GitHub Desktop.
Save RGGH/e19de4be8e8f8847cce6e5de3c874f29 to your computer and use it in GitHub Desktop.
Item
fn print_iter<T>(iter: impl Iterator<Item = T>)
where
T: std::fmt::Debug,
{
for i in iter {
println!("{:?}", i);
}
}
fn main() {
let vec_i32 = vec![1, 2, 3, 4, 5];
print_iter(vec_i32.into_iter());
let vec_u16: Vec<u16> = vec![1111, 112, 3, 4, 5];
print_iter(vec_u16.into_iter());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment