Froodi - an ergonomic Rust IoC container
Froodi is a lightweight, ergonomic Inversion of Control (IoC) container for Rust that helps manage dependencies with clear scoping and lifecycle management in a simple manner
Features
- Scoping: Any object can have a lifespan for the entire app, a single request, or even more fractionally
- Finalization: Some dependencies, like database connections, need not only to be created but also carefully released. Many frameworks lack this essential feature.
- Ergonomic: Simple API
- Speed: Dependency resolving as fast as the speed of light thanks to the Rust
- Integration: The popular frameworks for building applications is supported out of the box (axum, dptree)
- Safe: 100% safe Rust (no unsafe used)
- Thread safe: Thread safety enabled by default (
thread_safefeature) and can be disabled to useRcinstead ofArcand offSend/Syncrequirements
Quickstart
use ;
;
Examples
- Sync provide. This example shows how to provide sync dependencies.
- Async provide. This example shows how to provide async sync dependencies.
- Sync finalizer. This example shows how to add sync finalizers.
- Async finalizer. This example shows how to add async finalizers.
- Boxed dyn provide. This example shows how to provide boxed dyn dependencies.
- Axum. This example shows how to integrate the framework with Axum library.
- Dptree. This example shows how to integrate the framework with Dptree library.
You may consider checking out this directory for examples.
Contributing
Contributions are welcome!