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
//! `build.rs` codegen for skilj's own declarative bounded-context
//! format, Codeberg issue #5's "narrower cut" (see `docs/architecture.md`
//! [§17](../../docs/architecture.md#event-command-codegen-real) for the full design, and [§16](../../docs/architecture.md#declarative-bounded-context-codegen-prototype) for the prototype that scoped it
//! down to this). A `.skilj.toml` file describes one bounded context's
//! event/command type *shapes* only, fields, DCB tags and
//! `rest_trigger_allowed`, and this crate turns that into real Rust:
//! one payload struct and one `EventType`/`CommandType` impl per
//! declared type, plus the shared per-bounded-context event enum and
//! its `BoundedContextEvent` impl.
//!
//! **Deliberately narrow, not a gap to widen casually.**
//! `sensitive_fields`, the event creation-origin flags
//! (`external_creation_allowed`/`direct_creation_allowed`/
//! `event_read_allowed`), scheduling, `#[requires_role]`, and every
//! `Projection` concept are real, legitimate parts of the plugin API
//! this format doesn't cover - the [§16](../../docs/architecture.md#declarative-bounded-context-codegen-prototype) prototype's own recommendation
//! was to prove the mechanism on exactly what a real conversion needed
//! (`skilj-demo/src/banking.rs`, which uses none of those), not to
//! guess ahead of a second real use case.
//!
//! **`decide()`/`project()` stay hand-written Rust, always.** A
//! generated `CommandType::decide()` is one line, delegating to a
//! plain free function (`decide_<snake_case(NAME)>`) the including
//! module is expected to already define - see `emit::emit_command_type`'s
//! own doc comment. This crate never sees, needs, or could sensibly
//! generate real domain logic.
//!
//! **How a consumer uses this**: from its own `build.rs`, call
//! [`generate`] on a `.skilj.toml` file's contents, write the result to
//! `$OUT_DIR`, and `include!()` it from the hand-written module that
//! also defines the `decide_*` functions. See
//! `skilj-demo/build.rs`/`skilj-demo/src/banking.rs` for the real,
//! working example.
pub use ;
/// Parses `toml_source` (a `.skilj.toml` file's own contents) and
/// returns real, `prettyplease`-formatted Rust source - genuinely
/// readable when a consumer's own `build.rs` writes it to `$OUT_DIR`
/// for debugging, not a minified one-liner. See this crate's own root
/// doc comment for what the output covers.