Skip to main content

tachyon_types/
lib.rs

1pub mod category;
2pub use category::*;
3
4pub mod inventory;
5pub use inventory::*;
6
7pub mod output;
8pub use output::*;
9
10pub mod playbook;
11pub use playbook::*;
12
13pub mod pin;
14pub use pin::*;
15
16pub mod run;
17pub use run::*;
18
19pub mod resource;
20pub use resource::*;
21
22pub mod commands;
23pub use commands::*;
24
25/// Force the linker to keep every `#[myko_item]` / `#[myko_command]`
26/// registration in this crate.
27///
28/// Each entity and command self-registers via a static that the linker will
29/// drop (DCE) if nothing in the final binary references its module. The tachyon
30/// server binary references these types directly, but when tachyon-types is
31/// composed as a DEPENDENCY into another cell's server binary nothing
32/// references them, so without this the entities and commands would
33/// silently vanish from the composed cell. Call `tachyon_types::link()` once
34/// from the host cell during setup.
35///
36/// This list MUST stay exhaustive: every `#[myko_item]` and `#[myko_command]`
37/// in the crate needs a line below. Adding an entity or command without one
38/// drops it from any composed cell with no error.
39pub fn link() {
40    use std::hint::black_box;
41    // Entities (#[myko_item]).
42    black_box(std::any::type_name::<crate::Run>());
43    black_box(std::any::type_name::<crate::Playbook>());
44    black_box(std::any::type_name::<crate::Category>());
45    black_box(std::any::type_name::<crate::Pin>());
46    black_box(std::any::type_name::<crate::OutputLine>());
47    black_box(std::any::type_name::<crate::Inventory>());
48    // Commands (#[myko_command]).
49    black_box(std::any::type_name::<crate::RunPlaybook>());
50    black_box(std::any::type_name::<crate::CancelRun>());
51    black_box(std::any::type_name::<crate::PinPlaybook>());
52    black_box(std::any::type_name::<crate::ReportRunOutput>());
53    black_box(std::any::type_name::<crate::ReportRunFinished>());
54    black_box(std::any::type_name::<crate::ReportPlaybooks>());
55}