Open proofit404 opened 5 years ago
Value decorator can be applied to the coroutine functions.
In this case, we should be able to await them before injection.
Any attribute access on Injector should start dependency injection process.
Injector
So we need to make Injector awaitable itself.
class Container(Injector): app = App @value async def pool(loop): return await Pool(loop) await (await Container(loop=loop)).app.process()
In the case of asyncio user should put initiated loop instance inside injection scope manually.
asyncio
See #114.
In case of trio user should put the nursery inside the injection scope manually.
trio
Thanks for clarification!
Indeed, it should.
Value decorator can be applied to the coroutine functions.
In this case, we should be able to await them before injection.
Any attribute access on
Injector
should start dependency injection process.So we need to make
Injector
awaitable itself.In the case of
asyncio
user should put initiated loop instance inside injection scope manually.See #114.