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
use crateError;
use crateHub;
use async_trait;
use Arc;
/// A managed service component in the Gearbox framework.
///
/// Cogs are the building blocks of a Gearbox application. Each Cog is constructed
/// once at startup, stored in the [`Hub`] registry, and made available to route
/// handlers via the [`Inject<T>`](crate::Inject) extractor.
///
/// You rarely implement this trait by hand — the `#[cog]` proc macro generates
/// the implementation, the [`CogFactory`](crate::CogFactory), and the inventory
/// registration automatically.
///
/// # Example
///
/// ```ignore
/// #[cog]
/// pub struct UserService {
/// #[inject]
/// db: Arc<Database>,
/// #[config]
/// settings: UserConfig,
/// }
/// ```