Is it possible to figure out the parameter type and return type of a lambda?

Funny, I’ve just written a function_traits implementation based on Specializing a template on a lambda in C++0x which can give the parameter types. The trick, as described in the answer in that question, is to use the decltype of the lambda’s operator(). template <typename T> struct function_traits : public function_traits<decltype(&T::operator())> {}; // For generic types, … Read more

Traits and Rust

That block defines a new trait called Foo, which then allows you to use the trait in various places such as the impl block you have posted. The : Bar part says that any type that implements Foo must also implement the Bar trait.