1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! The `Injectable` trait — the primary marker for injectable types.
//!
/// Every type that wants to participate in the DI system must derive or
/// implement `Injectable`. The derive macro generates:
///
/// - An associated `Provider` type implementing [`Provider<T>`]
/// - Static dependency metadata for graph validation
/// - Lifecycle hook orchestration
use crateProvider;
/// The primary trait for types that can be dependency-injected.
///
/// # Derivable
///
/// This trait is normally derived via `#[derive(Injectable)]`:
///
/// ```rust,ignore
/// #[derive(Injectable)]
/// pub struct Database {
/// pool_size: usize,
/// }
/// ```
///
/// The derive macro generates:
/// - A `<Type>Provider` struct implementing `Provider<Type>`
/// - All necessary `Extract` calls for constructor parameters
/// - Lifecycle hook invocation (`post_construct`, `pre_destruct`)
///
/// # Associated Types
///
/// - `Provider`: The compile-time generated provider that knows how to
/// construct this type, including all its transitive dependencies.
///
/// # Bounds
///
/// All injectable types must be `Send + Sync + 'static` to support
/// async construction and shared access across threads.