Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created January 24, 2020 16:26
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 rust-play/7fc39974980739135253e755b2fa1433 to your computer and use it in GitHub Desktop.
Save rust-play/7fc39974980739135253e755b2fa1433 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
use std::fmt::Display;
fn do_things<T>(a: T, b: T) where
T: IntoIterator,
T::Item: Display {
for (e,f) in a.into_iter().zip(b.into_iter()) {
println!("{} {}", e, f);
}
}
fn main() {
do_things(&[1,2,3], &[4,5,6]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment