reinhardt_di/injected.rs
1//! Injection metadata types.
2//!
3//! `InjectionMetadata` and [`DependencyScope`] are shared between
4//! [`Depends`](crate::Depends) (the canonical dependency resolver) and
5//! historical consumers. The `Injected<T>` / `OptionalInjected<T>`
6//! wrappers that previously lived in this module were removed in 0.2.0
7//! per Issue #4520; use direct `Injectable` values or
8//! [`Depends<K, T>`](crate::Depends) for keyed provider output instead.
9
10/// Injection metadata
11///
12/// Tracks the scope and caching status of an injected dependency.
13#[derive(Debug, Clone, Copy)]
14pub struct InjectionMetadata {
15 /// Dependency scope (Request or Singleton)
16 pub scope: DependencyScope,
17 /// Whether caching was enabled during resolution
18 pub cached: bool,
19}
20
21/// Dependency scope
22#[derive(Debug, Clone, Copy, PartialEq, Eq)]
23pub enum DependencyScope {
24 /// Request-scoped dependency (lifetime tied to request)
25 Request,
26 /// Singleton-scoped dependency (shared across requests)
27 Singleton,
28}