Volga DI
A standalone, flexible, and easy-to-configure DI container.

💡 Status: Volga is currently in preview.
The public API may change while core abstractions are being finalized.
Getting Started
Dependencies
Standalone
[dependencies]
volga-di = "..."
Part of Volga Web Framework
[dependencies]
volga = { version = "...", features = ["di"] }
Example
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use volga_di::ContainerBuilder;
#[derive(Default, Clone)]
struct InMemoryCache {
inner: Arc<Mutex<HashMap<String, String>>>
}
fn main() {
let mut container = ContainerBuilder::new();
container.register_singleton(InMemoryCache::default());
let container = container.build();
let Ok(cache) = container.resolve::<InMemoryCache>() else {
panic!("Unable to resolve InMemoryCache")
};
}
License
Volga is licensed under the MIT License. Contributions welcome!