Lifetimes
Transient
Transients are constructed every time when requested. For transients, the following container types are supported:
T
: No container.Box<T>
: A boxed type, whereT
can be adyn T
.
Singleton
Singletons are lazily constructed on the first access, and only a single instance can be created over the programs lifetime. When requested, a reference to the object is returned. The following container types are supported:
Rc<T>
: Whenmultithread
andtokio
feature are disabled.Arc<T>
: When themultithread
ortokio
is enabled.
The library offers a Ref
type alias, which is aliasing the correct
container, based on the enabled features.
The next step is to understand registration.