Skip to content

Instantly share code, notes, and snippets.

@bstrie
Created May 24, 2014 07:29
Show Gist options
  • Save bstrie/4f773b1928fe3b8a90f9 to your computer and use it in GitHub Desktop.
Save bstrie/4f773b1928fe3b8a90f9 to your computer and use it in GitHub Desktop.
trait Foo {
fn new() -> Self;
}
struct Bar(int, int);
impl Foo for Bar {
fn new() -> Bar {
Bar(1, 2)
}
}
impl Foo for (int, int) {
fn new() -> (int, int) {
(3, 4)
}
}
fn main() {
let ts = Foo::new::<Bar>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment