With fully defined syntax, Foo::bar will work, resulting in fn(&Foo) ->() (similar to Python); if this is what you want (i.e. call it as callback(&foo) ):
let callback = Foo::bar;
However, if you want the self variable to be already bound (like, for example, callback() will be the same as calling bar for the foo object), you need to use an explicit closure
let callback = || foo.bar();
huon
source share