--- layout: home title: Home ---
v0.1.0 — Now Available

Dependency Injection
Lightning Fast

A high-performance, lock-free dependency injection container for Rust. Type-safe, zero-config, and built for modern concurrent applications.

Cargo.toml
[dependencies]
dependency-injector = "0.1"

Why Armature DI?

Built from the ground up for performance and ergonomics in modern Rust applications.

Lock-Free

Uses DashMap for ~10x faster concurrent access compared to RwLock-based containers.

Type-Safe

Compile-time type checking with zero runtime overhead. Errors caught before deployment.

Zero-Config

Any Send + Sync + 'static type is automatically injectable. No boilerplate required.

Scoped Containers

Hierarchical scopes with full parent chain resolution. Perfect for request-scoped services.

Flexible Lifetimes

Singleton, lazy singleton, and transient lifetimes. Choose what fits your use case.

Observable

Optional tracing integration for debugging and monitoring service resolution.

Simple, Intuitive API

Get started in seconds with a clean, ergonomic interface.

main.rs
use dependency_injector::Container;

// Define your services
#[derive(Clone)]
struct Database { url: String }

#[derive(Clone)]
struct UserService { db: Database }

fn main() {
    // Create container
    let container = Container::new();

    // Register services
    container.singleton(Database {
        url: "postgres://localhost".into()
    });

    // Lazy initialization
    container.lazy(|| UserService {
        db: container.get().unwrap()
    });

    // Resolve anywhere
    let users = container.get::<UserService>().unwrap();
}

No Boilerplate

No traits to implement, no macros to apply. Just use your types directly.

Arc-Based Sharing

Returns Arc<T> for zero-copy sharing across threads and components.

Lazy by Default

Services created on first access. No wasted initialization.

Scoped Testing

Create child scopes to override services for testing without affecting parents.

Ready to get started?

Add Armature DI to your project and experience dependency injection done right.