Skip to main content

sim_lib_core/
lib.rs

1#![forbid(unsafe_code)]
2#![deny(missing_docs)]
3//! Shared surface-pack substrate for SIM runtime libraries.
4//!
5//! The kernel defines the `Lib`/`Registry`/`ExportRecord` contracts; this crate
6//! supplies the shared substrate for declaring exported value cards as data and
7//! installing them once, idempotently, into a registry.
8//!
9//! Source admission has one separate, deliberately indivisible product:
10//! [`SourceAuthority`] carries trusted host policy, caller requirements, and
11//! diminished allowed powers into [`ReadEvalRequest`] or [`DynamicSourcePolicy`].
12//! Guest libraries may add source syntax and semantic policy, but never another
13//! admission envelope. The host constructs authority; source data cannot.
14
15use sim_kernel::Symbol;
16
17mod read_eval;
18#[cfg(test)]
19mod source_authority_ownership_tests;
20pub mod surface;
21
22/// Recipes embedded at build time from this crate's `recipes/` tree.
23pub static RECIPES: sim_cookbook::EmbeddedDir =
24    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
25
26pub use read_eval::{
27    ConfigEvalNode, DynamicSourcePolicy, HostConfigEvalOptIn, ReadEvalAdmission, ReadEvalBroker,
28    ReadEvalBrokerLib, ReadEvalDecision, ReadEvalOutcome, ReadEvalRequest, ReadEvalSource,
29    RequestOrigin, SourceAuthority, config_eval_node_symbol, config_eval_origin_tag,
30    install_read_eval_broker, parse_config_eval_node, read_eval_broker_lib_id,
31    read_eval_broker_symbol, read_eval_decision_run, realize_config_expr,
32};
33pub use surface::{
34    SurfaceField, SurfacePackLib, SurfacePackSpec, SurfaceValueSpec, card_expr, install_once,
35    install_once_id, installed_lib_id,
36};
37
38/// Returns the manifest name under which this surface pack installs (`lisp:core`).
39///
40/// # Examples
41///
42/// ```
43/// use sim_kernel::Symbol;
44///
45/// assert_eq!(sim_lib_core::manifest_name(), Symbol::qualified("lisp", "core"));
46/// ```
47pub fn manifest_name() -> Symbol {
48    Symbol::qualified("lisp", "core")
49}