Skip to content

Instantly share code, notes, and snippets.

/playground.rs

Created Dec 27, 2016
Embed
What would you like to do?
Shared via Rust Playground
use std::fmt::Debug;
const DEFINITIONS: &'static [&'static str] = &[
"a flaky coating of iron oxide",
"fungal plant disease",
"a reddish-brown color",
];
fn main() {
print_all(DEFINITIONS);
dump(DEFINITIONS);
}
fn print_all<'a, T>(items: T)
where T: IntoIterator<Item=&'a &'a str>
{
for item in items {
println!("{}", item);
}
}
// Excerpt From: Jim Blandy and Jason Orendorff. "Programming Rust."
fn dump<T, U>(t: T)
where T: IntoIterator<Item=U>,
U: Debug
{
for u in t {
println!("{:?}", u);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.