Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created February 9, 2013 03:32
Show Gist options
  • Save alexcrichton/4743714 to your computer and use it in GitHub Desktop.
Save alexcrichton/4743714 to your computer and use it in GitHub Desktop.
use core::hashmap::linear::LinearSet;
struct Foo {
n: LinearSet<int>,
}
impl Foo {
fn foo(&mut self, fun: fn(&int)) {
for self.n.each |f| {
fun(f);
}
}
}
fn bar(f: &mut Foo) {
do f.foo |a| {
f.n.insert(*a);
}
}
fn main() {
let mut f = Foo { n: LinearSet::new() };
bar(&mut f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment