Skip to content

Instantly share code, notes, and snippets.

@JEG2
Created August 29, 2014 14:47
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 JEG2/460b5f98e9b7f14561d2 to your computer and use it in GitHub Desktop.
Save JEG2/460b5f98e9b7f14561d2 to your computer and use it in GitHub Desktop.
Exploring capturing strings in a Rust task.
use std::collections::HashMap;
fn main() {
let mut services = HashMap::new();
services.insert("S1", vec!["A", "C"]);
for (name, stops) in services.iter() {
spawn( proc() {
println!("{}", name);
} );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment