[]
= "0"
Compiler support: requires rustc 1.64+
Changelog
Features
- Can register and inject any type (incl. generics, types must be
Send+Syncif themultithreadfeature is enabled). - Simple and elegant Rust API, making the derive macro purely optional.
- Different dependency lifetimes:
- Singleton: Only a single instance of the object is created.
- Transient: A new instance is created for every request.
- Derive macro (
#[derive(Inject)]) to simplify registration. - Automatic registration of types.
- One global registry; with support for multipiple sub-registries.
Usage
Add the dependency to your Cargo.toml:
Register your types with the Registry:
use ;
use
Features
Ferrunix has the following features to enable further functionality.
Default features are marked with *.
multithread(*): Enable support for access to the registry from multiple threads. This adds a bound that all registered types must beSendandSync.derive(*): Enable support for the#[derive(Inject)]macro.