Skip to main content

sim/runtime/
serial_music_stack.rs

1//! Serial-music SDK cookbook bundle and runtime installer.
2//!
3//! The curated serial facade is intentionally thin. This runtime-side wrapper
4//! only gives the cookbook directory one stable loadable row and embeds the
5//! SDK-owned serial recipes.
6
7use sim_kernel::{AbiVersion, Cx, Lib, LibManifest, LibTarget, Linker, Result, Symbol, Version};
8
9#[cfg(feature = "cookbook")]
10mod cookbook;
11
12#[cfg(feature = "cookbook")]
13pub use cookbook::RECIPES;
14
15/// Host-registered cookbook row for the curated serial-music SDK facade.
16pub struct SerialMusicCookbookLib;
17
18impl Lib for SerialMusicCookbookLib {
19    fn manifest(&self) -> LibManifest {
20        LibManifest {
21            id: serial_music_manifest_symbol(),
22            version: Version(env!("CARGO_PKG_VERSION").to_owned()),
23            abi: AbiVersion { major: 0, minor: 1 },
24            target: LibTarget::HostRegistered,
25            requires: Vec::new(),
26            capabilities: Vec::new(),
27            exports: Vec::new(),
28        }
29    }
30
31    fn load(&self, _cx: &mut sim_kernel::LoadCx, _linker: &mut Linker<'_>) -> Result<()> {
32        Ok(())
33    }
34}
35
36/// Installs the serial-music cookbook row into a context.
37pub fn install_serial_music_stack(cx: &mut Cx) -> Result<()> {
38    sim_lib_core::install_once(cx, &SerialMusicCookbookLib)?;
39    Ok(())
40}
41
42/// Returns the manifest id for the serial-music SDK cookbook row.
43pub fn serial_music_manifest_symbol() -> Symbol {
44    Symbol::qualified("sdk", "serial-music")
45}