crate_interface_lite
A lightweight version of crate_interface written with declarative macros.
Example
// Define the interface
def_interface!;
// Implement the interface in any crate
;
impl_interface!;
// Call `HelloIfImpl::hello` in any crate
use call_interface;
assert_eq!;
assert_eq!;
Comparison with crate_interface
Similar: APIs
The public APIs are almost the same as crate_interface. One major difference is that you cannot use the exported macros as attributes.
// With crate_interface...
// With crate_interface_lite...
def_interface!;
Different: No proc-macro related dependencies
This is the major reason to use this crate, as it would result in a tidier dependency tree of your project and slightly speed up the compilation. However, if you already have proc-macro related dependencies in your crate’s dependency graph, there is almost no benefit from using this crate.
Different: No support for method receivers
Unlike crate_interface::def_interface, the macro in this crate does not support
method receivers, namely self, &self, &mut self, etc. But in most cases, you
don't need them, since the impl_interface is often applied to an unit struct.
def_interface!;
Different: No support for default implementations
The def_interface in this crate does not support default implementations of
trait functions. In the future, we may support using default implementations as
fallbacks when no other implementations are provided.
def_interface!;