Last active
February 13, 2016 15:41
-
-
Save sophiajt/7d116048fd85adcb698b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn simple_fn(x: i32) -> i32 { | |
x + 100 | |
} | |
trait FooFn { | |
fn foo(&self); | |
} | |
impl FooFn for Fn(i32)->i32 { | |
fn foo(&self) { | |
println!("Function foo!"); | |
} | |
} | |
fn main() { | |
//Works | |
//let f : fn(i32)->i32 = simple_fn; | |
//f.foo(); | |
//error: no method named `foo` found for type `fn(i32) -> i32 {simple_fn}` in the current scope | |
simple_fn.foo(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment