Re: [rust-dev] Pointer to trait method?

2014-02-14 Thread Alex Crichton
You'll always need a concrete type in order to get the trait method for that type. Something like this may work for you though: trait A { fn foo(Self); } impl A for int { fn foo(a: int) {} } fn main() { let f: fn(int) = A::foo; } On Fri, Feb 14, 2014 at 2:14 PM, Tommy M. McGuire wrote:

[rust-dev] Pointer to trait method?

2014-02-14 Thread Tommy M. McGuire
Suppose I have a trait T: trait A { fn fun(t:T); // <- [1] } Is there a way to get a pointer to the implementation of fun for a specific T? How would I go about calling it? (Yeah, I know I'm kinda far off the reservation.) [1] Not necessarily an instance method, but that would be useful, too.