| Crates.io | volga-di |
| lib.rs | volga-di |
| version | 0.8.1 |
| created_at | 2025-08-01 14:01:16.958974+00 |
| updated_at | 2026-01-25 10:52:57.450656+00 |
| description | Dependency Injection tools for Volga Web Framework |
| homepage | https://romanemreis.github.io/volga-docs |
| repository | https://github.com/RomanEmreis/volga |
| max_upload_size | |
| id | 1776836 |
| size | 33,599 |
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.
[dependencies]
volga-di = "0.8.1"
[dependencies]
volga = { version = "0.8.1", features = ["di"] }
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")
};
// Do work...
}