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 has a receiver, and the receiver is
&self,&mut selforself -
has no generic types in the trait or the method (may change in the future versions)
-
has no generic lifetime in the trait (may change in the future versions)
-
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;