sim_run_core/receipt.rs
1use sim_kernel::{ExportRecord, LibBootDependency, LibId, LibManifest};
2
3use crate::LibSourceSpec;
4
5/// The role a loaded library serves in a boot session.
6#[derive(Clone, Debug, PartialEq, Eq)]
7pub enum LoadReceiptRole {
8 /// A library requested with `--load`.
9 Library,
10 /// The selected codec loaded before the rest of the boot list.
11 BootCodec {
12 /// Codec name selected for the boot session.
13 name: String,
14 /// Codec library symbol that was loaded.
15 symbol: String,
16 },
17}
18
19impl LoadReceiptRole {
20 pub(crate) fn boot_codec(name: impl Into<String>, symbol: impl Into<String>) -> Self {
21 Self::BootCodec {
22 name: name.into(),
23 symbol: symbol.into(),
24 }
25 }
26}
27
28/// Receipt for one library loaded by the bootloader.
29#[derive(Clone, Debug, PartialEq, Eq)]
30pub struct LoadReceipt {
31 /// Identifier assigned to the loaded library.
32 pub lib_id: LibId,
33 /// Role the library serves in the boot session.
34 pub role: LoadReceiptRole,
35 /// Source as requested on the command line.
36 pub requested_source: LibSourceSpec,
37 /// Source after resolution to a concrete artifact.
38 pub resolved_source: LibSourceSpec,
39 /// Manifest declared by the loaded library.
40 pub manifest: LibManifest,
41 /// Boot dependencies pulled in while loading.
42 pub dependencies: Vec<LibBootDependency>,
43 /// Export records published by the library.
44 pub exports: Vec<ExportRecord>,
45}