Crates.io | dirk_framework |
lib.rs | dirk_framework |
version | 0.1.1 |
source | src |
created_at | 2024-11-03 21:23:56.783952 |
updated_at | 2024-11-03 21:23:56.783952 |
description | Dependency Injection for Rust |
homepage | |
repository | https://github.com/hundsdor/dirk.git |
max_upload_size | |
id | 1434270 |
size | 74,601 |
Dirk is a compile-time Dependency Injection tool for Rust, focusing on usability and developer experience.
Dependency Injection for Rust at (K)Compile-time
A dirk is a long-bladed thrusting weapon used as personal sidearm by Scottish Highlanders during the 18th century. This tool may be used accordingly as a sidearm for injecting instances into your code.
Furthermore, a dirk resembles a dagger, which pays tribute to the framework Dagger by Google, from which dirk has been inspired.
The following small comparison has been derived from an attempt to implement some of the examples using other DI tools for Rust. If you are convinced that I absolutely missed or misinterpreted some aspects here, feel free to contact me and I will do my best to put things right.
Feature | dirk | teloc | shaku | waiter_di |
---|---|---|---|---|
injection at compile-time | yes | yes | yes | yes |
injection of generic types | yes | no | only with manual impl | no |
global singletons | yes | no | only with manual impl | no |
expressive error messages | as good as possible* | no | no | no |
allows (interior) mutability | yes | yes | no | no |
*procedural macros do not always allow access to all information necessary to yield good error messages