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
//! Profile requirements — decouple domain crates from `edi-energy`.
//!
//! Domain crates (`mako-gpke`, `mako-wim`, …) declare which EDIFACT message
//! types they depend on by implementing
//! [`EngineModule::profile_requirements`]. The engine builder validates these
//! requirements against the injected `ReleaseRegistry` at startup — without
//! requiring domain crates to import `edi-energy` in their production
//! `[dependencies]`.
//!
//! # Example (domain crate)
//!
//! ```rust,ignore
//! use mako_engine::builder::EngineModule;
//! use mako_engine::profile::ProfileRequirement;
//!
//! pub struct GpkeModule;
//!
//! impl EngineModule for GpkeModule {
//! fn name(&self) -> &'static str { "gpke" }
//!
//! fn profile_requirements(&self) -> &'static [ProfileRequirement] {
//! &[
//! ProfileRequirement { message_type: "UTILMD", label: "UTILMD Strom" },
//! ProfileRequirement { message_type: "INVOIC", label: "INVOIC Abrechnung" },
//! ]
//! }
//! }
//! ```
//!
//! # Validation
//!
//! [`EngineBuilder::build`] calls every registered module's
//! [`EngineModule::profile_requirements`] method. For each requirement it checks that the
//! caller-supplied validation function (see
//! [`EngineBuilder::with_profile_validator`]) confirms at least one active
//! profile exists. If not, `build` panics with an actionable error message —
//! exactly like `configure()` used to, but without the `edi-energy` import.
//!
//! [`EngineModule::profile_requirements`]: crate::builder::EngineModule::profile_requirements
//! [`EngineBuilder::build`]: crate::builder::EngineBuilder::build
//! [`EngineBuilder::with_profile_validator`]: crate::builder::EngineBuilder::with_profile_validator
/// A single profile requirement declared by a domain module.
///
/// The engine builder validates that at least one active profile satisfying
/// this requirement exists in the `edi-energy` registry.
///
/// Domain crates return a `&'static [ProfileRequirement]` slice from
/// [`EngineModule::profile_requirements`] — no `edi-energy` import required.
///
/// [`EngineModule::profile_requirements`]: crate::builder::EngineModule::profile_requirements