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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! Service auto-registration for Ferro framework
//!
//! This module provides automatic service registration via macros:
//! - `#[service(ConcreteType)]` - auto-register trait bindings
//! - `#[derive(Injectable)]` - auto-register concrete types as singletons
//!
//! # Example - Trait binding
//!
//! ```rust,ignore
//! use ferro_rs::service;
//!
//! // Auto-register: dyn CacheStore → RedisCache
//! #[service(RedisCache)]
//! pub trait CacheStore: Send + Sync + 'static {
//! fn get(&self, key: &str) -> Option<String>;
//! fn set(&self, key: &str, value: &str);
//! }
//!
//! pub struct RedisCache;
//! impl Default for RedisCache {
//! fn default() -> Self { Self }
//! }
//! impl CacheStore for RedisCache { ... }
//! ```
//!
//! # Example - Concrete singleton
//!
//! ```rust,ignore
//! use ferro_rs::injectable;
//!
//! #[injectable]
//! pub struct AppState {
//! pub counter: u32,
//! }
//!
//! // Resolve via:
//! let state: AppState = App::get().unwrap();
//! ```
/// Entry for inventory-collected service bindings (trait → impl)
///
/// Used internally by the `#[service(ConcreteType)]` macro to register
/// service bindings at compile time.
/// Entry for inventory-collected singleton registrations (concrete types)
///
/// Used internally by the `#[derive(Injectable)]` macro to register
/// concrete singletons at compile time.
// Inventory collection for auto-registered service bindings
collect!;
// Inventory collection for auto-registered singletons
collect!;
/// Register all service bindings from inventory
///
/// This is called automatically by `Server::from_config()`.
/// It registers all services marked with `#[service(ConcreteType)]`.
/// Register all singleton entries from inventory
///
/// This is called automatically by `Server::from_config()`.
/// It registers all types marked with `#[derive(Injectable)]`.
/// Full bootstrap sequence for services
///
/// Called automatically by `Server::from_config()`.
/// Service info for introspection
/// Type of service binding
/// Get all registered services for introspection
///
/// Returns a list of all services registered via `#[service(ConcreteType)]`
/// and `#[injectable]` macros.