Type Provider
bevy.providers.type_provider.TypeProvider
Bases: Provider[Type[_T], _T]
The type provider supports any class type and will attempt to instantiate them with no args if they aren't found in the repository's cache.
Example
class Demo:
...
@inject
def example(arg: Demo = dependency()):
...
factory
factory(key: Type[_T], _) -> Option[Callable[[], _T]]
Returns a constructor callable if the key is a class type. The __bevy_constructor__
method is used when
implemented by the class type, otherwise the class type will be returned.
supports
supports(key: Type[_T], _) -> bool
Only allows the TypeProvider
to work with class types.