In entrait 0.5, I want more focus on dependency inversion and less focus on mocking out every single function.
The main advantages of the entrait pattern for functions are:
Abstracting away the application, all business logic is available as extension methods on Impl<T>
Each function only specifies its direct dependencies. The trait engine automatically takes care of verifying that transitive dependencies are fulfilled.
Support for mocking every little function when unimock is enabled is potentially generating a lot more code than necessary.
Instead, by default, we could try to generate a very simple impl<T> Trait for T where T: Dependencies that could cover both Impl<T> and mocked environments. Mocking a simple function will become opt-in, with something like #[entrait(Foo, mock)]).
Mock support should be enabled by default on inverted dependencies - the ones that have no local implementation.
Rename async-trait to boxed-futures.
async-trait is just an implementation detail on the way to get boxed futures, and this does not need to be exposed.
Change default behaviour for mockability
In entrait 0.5, I want more focus on dependency inversion and less focus on mocking out every single function.
The main advantages of the entrait pattern for functions are:
Impl<T>
Support for mocking every little function when unimock is enabled is potentially generating a lot more code than necessary. Instead, by default, we could try to generate a very simple
impl<T> Trait for T where T: Dependencies
that could cover bothImpl<T>
and mocked environments. Mocking a simple function will become opt-in, with something like#[entrait(Foo, mock)]
).Mock support should be enabled by default on inverted dependencies - the ones that have no local implementation.
Rename
async-trait
toboxed-futures
.async-trait
is just an implementation detail on the way to get boxed futures, and this does not need to be exposed.~## Investigate trait redesign~ ~https://github.com/audunhalland/entrait/issues/11~