injectable-rs
A compile-time dependency injection (DI) framework for Rust using extractor-based DI, inspired by Axum's typed extraction model.
No TypeId in the public API, no runtime reflection, no
HashMap<TypeId, Box<dyn Any>>. Dependencies are resolved through typed
extractors, provider chains are generated at compile time, and dependency
traversal is statically encoded into generated provider implementations.
Features
#[injectable]derive macro for your own typesbind!/container!macros for composing a DI containerInjectextractor for constructor-style injection- Lazy resolution: dependencies are only constructed when requested
- Optional
axumintegration (features = ["axum"])
Quick start
use ;
License
Dual-licensed under MIT OR Apache-2.0.