| Crates.io | ferrunix |
| lib.rs | ferrunix |
| version | 0.5.1 |
| created_at | 2024-10-09 07:07:48.265781+00 |
| updated_at | 2025-04-25 15:45:46.412608+00 |
| description | A lightweight run-time dependency injection framework for Rust |
| homepage | https://github.com/Leandros/ferrunix |
| repository | https://github.com/Leandros/ferrunix |
| max_upload_size | |
| id | 1402087 |
| size | 73,727 |
[dependencies]
ferrunix = "0.5"
Compiler support: requires rustc 1.70.0+
Check out the User Guide.
Due to how the various features affect the public API of the library, the documentation is provided for each major feature separately.
| Feature Flags | Link to Documentation |
|---|---|
none |
link to docs |
multithread |
link to docs |
tokio |
link to docs |
Can register and inject any type (incl. generics, types must be Send if the
multithread feature is enabled, and Send + Sync if tokio is enabled).
Simple and elegant Rust API; making the derive macro purely optional.
Different dependency lifetimes:
Dependency resolution happens at run time, making it possible to dynamically register types.
Injection of concrete value types (T), Box<T>, Rc<T>, and Arc<T>.
Derive macro (#[derive(Inject)]) to simplify registration.
Automatic registration of types, thanks to
inventory.
One global registry; with support for multiple sub-registries.
Ferrunix has the following features to enable further functionality.
Features enabled by default are marked with *.
multithread: Enables support for accessing the registry from multiple
threads. This adds a bound that all registered types must be Send.derive (*): Enables support for the #[derive(Inject)] macro.tokio: Enables support for async constructors. Bumps the MSRV up to
1.75.0 because some of the internal traits require
RPITIT.tracing: Enables support for tracing and annotates all public functions with
tracing::instrument.Development of ferrunix is sponsored by RagnarLab. RagnarLab is a Rust consultancy based in Stuttgart, Germany. We provide Rust development from prototype to product, helping you write safer software. Interested in Rust? Get in touch with us.