Expand description
You’re viewing the documentation with the multithread
feature turned on.
§Ferrunix
A simple, idiomatic, and lightweight dependency injection framework for Rust.
For a comprehensive introduction check out the user guide.
§Documentation
Due to how the various features affect the public API of the library, the documentation is provided seperately for each major feature.
Documentation on docs.rs is compiled with the multithread
feature turned on
Feature Flags | Link to Documentation |
---|---|
none | link to docs |
multithread | link to docs |
tokio | link to docs |
§Getting Started
The easiest way to get started is with the multi-threaded registry, and the derive macro, you can enable this as follows:
[dependencies]
ferrunix = { version = "0.5", features = ["multithread"] }
§Cargo Feature Flags
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 beSend
.derive
(*
): Enables support for the#[derive(Inject)]
macro.tokio
: Enables support forasync
constructors. Bumps the MSRV up to1.75.0
because some of the internal traits require RPITIT.tracing
: Enables support for tracing and annotates all public functions withtracing::instrument
.
Modules§
- dependencies
- All possible dependencies for injected types.
- dependency_
builder - Implementation of
DepBuilder
for tuples to be used withRegistry::with_deps
. - error
- All errors that might happen.
- registry
- Holds all registered types that can be injected or constructed.
- types
- Type aliases.
Macros§
- autoregister
- Register a
RegistrationFunc
. Usually invoked by the derive macro.
Structs§
- Registration
Func - All auto-registration functions need to use this type for registration.
- Registry
- Registry for all types that can be constructed or otherwise injected.
- Singleton
- Singleton dependencies.
- Transient
- Transient dependencies.
Type Aliases§
- Ref
- A generic reference type that’s used as the default type for types with the singleton lifetime.