Skip to content

Instantly share code, notes, and snippets.

@olsonjeffery
Created September 23, 2013 18:46
Show Gist options
  • Save olsonjeffery/6675045 to your computer and use it in GitHub Desktop.
Save olsonjeffery/6675045 to your computer and use it in GitHub Desktop.
hm.
trait Foo { fn bar(&self) -> bool; }
struct A;
impl Foo for A { fn bar(&self) -> bool { true } }
struct B;
impl Foo for B { fn bar(&self) -> bool { false } }
let a = A; let b = B; let v = ~[&a as &Foo, &b as &Foo];
for i in v.iter() { println!("{}", i.bar()); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment