volga-di

Crates.iovolga-di
lib.rsvolga-di
version0.8.1
created_at2025-08-01 14:01:16.958974+00
updated_at2026-01-25 10:52:57.450656+00
descriptionDependency Injection tools for Volga Web Framework
homepagehttps://romanemreis.github.io/volga-docs
repositoryhttps://github.com/RomanEmreis/volga
max_upload_size
id1776836
size33,599
Roman (RomanEmreis)

documentation

https://docs.rs/volga

README

Volga DI

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

latest latest License: MIT Build Release

💡 Status: Volga is currently in preview.
The public API may change while core abstractions are being finalized.

Getting Started

Dependencies

Standalone

[dependencies]
volga-di = "0.8.1"

Part of Volga Web Framework

[dependencies]
volga = { version = "0.8.1", 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")
    };

    // Do work...
}
Commit count: 195

cargo fmt