rust_dependencies 0.1.2

Typed dependency injection for Rust — DependencyValues and DependencyKey with Clock, Uuid, Now, and Rng built-ins.
Documentation

rust_dependencies

Typed dependency injection for Rust

Register values by type, swap live vs test implementations, and override individual deps without global state.

Install

[dependencies]
rust_dependencies = "0.1.2"

Quick start

use rust_dependencies::{DependencyKey, DependencyValues, UuidDep};

let bag = DependencyValues::test();
let uuid = bag.require::<UuidDep>().unwrap().0.next();
assert_ne!(uuid, 0);

Built-in dependencies

Key Purpose
ClockKey Monotonic Instant (debounce, elapsed time)
NowKey Wall SystemTime (timestamps)
UuidKey Unique u128 identifiers
RngKey u64 random draws

Each key provides live() (production) and test() (deterministic) via [DependencyKey].

Documentation

Used by

rust-elm re-exports this crate for effect environments and runtime wiring.

License

MPL-2.0 — see LICENSE.