Open the-moisrex opened 2 years ago
An extension can specify the conditions that is required for a dependency to be constructed.
struct user { std::string username; }; struct injector { template <Traits TraitsType, typename C> static constexpr bool can_inject = std::invocable_with<C, user>; static constexpr user construct_injection(Context auto&& ctx) { return user{ .username = ctx.header('username') }; } };
It's just an example here.
This issue has conflicts with #65
Dependency Injection is possible using Custom Bodies.
An extension can specify the conditions that is required for a dependency to be constructed.
It's just an example here.