Functional trait
Description
A simple macro that inspired by java's functional interface.
the macro impls a trait for Fn, FnMut or FnOnce when the trait:
-
contains one and only one method
-
the method's has a receiver,and the receiver is
&self,&mut selforself -
has no generics in the trait or the method (maybe I will add generics in the macro)
-
has no super trait(may change in the future versions)
-
is not unsafe
-
have no unsafe method(may change in the future versions)
Example
use functional_trait;