When I try to call a trait method on a function pointer:
trait Foo {
fn do_it(&self, i: i32);
}
impl Foo for fn(i32) {
fn do_it(&self, i: i32) {
self(i)
}
}
fn bar(i: i32) {}
fn baz() {
bar.do_it(7);
}
The compiler says no method named 'do_it' found for fn item 'fn(i32) {bar}' in the current scope ... note: 'Foo' defines an item 'do_it', perhaps you need to implement it.
What's wrong with my implementation?