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
// Copyright © 2026 Kirky.X. All rights reserved.
//! Module trait — the standard interface for all modules.
use Error;
use ModuleBuilder;
/// The standard interface that all modules must implement.
///
/// A module declares:
/// - `NAME`: A diagnostic name for the module.
/// - `Config`: The configuration type required for initialization.
/// - `Requirements`: The dependencies required for initialization.
/// - `Capability`: The capability facade exposed to consumers.
/// - `Error`: The initialization error type.
/// - `Builder`: The standard builder type that implements `ModuleBuilder<Self>`.
///
/// # Associated Types
///
/// - `Config`: Use `NoConfig` if the module requires no configuration.
/// - `Requirements`: Use `NoRequirements` if the module has no dependencies.
/// - `Capability`: Typically `Arc<dyn SomeTrait + Send + Sync>`.
/// - `Error`: Must satisfy `std::error::Error + Send + Sync + 'static`.
/// - `Builder`: Must implement `ModuleBuilder<Self>`.
///
/// # Example
///
/// ```
/// use trait_kit::prelude::*;
/// use std::sync::Arc;
///
/// struct MyModule;
/// impl Module for MyModule {
/// const NAME: &'static str = "my_module";
/// type Config = NoConfig;
/// type Requirements = NoRequirements;
/// type Capability = Arc<i32>;
/// type Error = std::convert::Infallible;
/// type Builder = MyBuilder;
/// }
///
/// struct MyBuilder;
/// impl ModuleBuilder<MyModule> for MyBuilder {
/// fn build(self) -> Result<Arc<i32>, std::convert::Infallible> {
/// Ok(Arc::new(42))
/// }
/// }
/// ```