Skip to content

Instantly share code, notes, and snippets.

@k4nar
Created February 12, 2014 14:17
Show Gist options
  • Save k4nar/8956309 to your computer and use it in GitHub Desktop.
Save k4nar/8956309 to your computer and use it in GitHub Desktop.
Calling trait's static function from trait's implementation
trait Foo {
fn foo() -> int { 10 }
}
struct FooStruct;
impl Foo for FooStruct {
fn bar(&self) {
println!("Foo : {}", Foo::foo());
}
}
fn main() {
let foo = FooStruct;
foo.foobar();
}
// testcase.rs:9:26: 9:34 error: cannot determine a type for this bounded type parameter: unconstrained type
// testcase.rs:9 println!("Foo : {}", Foo::foo());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment