| Crates.io | volga-di |
| lib.rs | volga-di |
| version | 0.6.4 |
| created_at | 2025-08-01 14:01:16.958974+00 |
| updated_at | 2025-09-05 16:22:58.266827+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 | 28,047 |
A standalone, flexible, and easy-to-configure DI container.
💡 Note: This project is currently in preview. Breaking changes can be introduced without prior notice.
[dependencies]
volga-di = "0.6.4"
[dependencies]
volga = { version = "0.6.3", features = ["di"] }
[dependencies]
volga = { version = "0.6.4", features = ["di-full"] }
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
#[derive(Default)]
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 {
eprintln!("Unable to resolve InMemoryCache")
};
// Do work...
}