Skip to main content

injectable_rs_graph/
lib.rs

1//! Dependency graph validation for the `injectable` framework.
2//!
3//! This crate provides compile-time (startup-time) validation of the
4//! dependency graph, including:
5//! - Circular dependency detection via DFS
6//! - Missing dependency detection
7//! - Duplicate constructor/lifecycle hook detection
8//!
9//! The graph is built from metadata submitted by the proc macros via
10//! the `inventory` crate. Each `#[derive(Injectable)]` or
11//! `#[injectable_impl]` submits a `GraphNode` that is automatically
12//! collected when `Container::build()` is called. The graph is validated
13//! once at container build time and is **not** used during runtime
14//! resolution — providers resolve dependencies through static dispatch.
15
16#![forbid(unsafe_code)]
17#![deny(missing_docs)]
18
19mod error;
20mod graph;
21mod node;
22mod validate;
23
24pub use error::GraphError;
25pub use graph::DependencyGraph;
26pub use node::GraphNode;
27pub use validate::ValidationError;
28
29// Collect all GraphNode instances submitted by proc macros across the crate
30// and its dependencies. The `inventory` crate uses linker sections to gather
31// these at binary startup time, so `inventory::iter::<GraphNode>()` yields
32// every submitted node without any manual registration.
33inventory::collect!(GraphNode);