sim_lib_scene/lib.rs
1//! Scene value model and `codec:scene` for the SIM Web-UI.
2//!
3//! A Scene is a portable graphical intermediate representation that is itself a
4//! SIM value: a tree of scene nodes built on kernel `Value`/`Expr` using open
5//! maps with a `kind` tag, never a closed kernel enum. The browser is the only
6//! thing that turns a Scene into pixels; everything upstream just produces
7//! Scene values. Because a Scene is a value it round-trips through
8//! `codec:scene`, can be snapshotted, diffed, golden-tested, sent over the
9//! wire, or read by an agent.
10//!
11//! This crate provides:
12//!
13//! - the scene node [`kinds`] (open metadata, not a closed enum);
14//! - a [`model`] of builders, accessors, and fail-closed validation;
15//! - a lossless canonical [`text`] form for the scene-data subset of `Expr`;
16//! - the [`codec`] `codec:scene` (a domain codec) plus scene node [`shapes`];
17//! - a [`diff()`]/apply pair over scenes (scene diffs are themselves values).
18
19#![forbid(unsafe_code)]
20#![deny(missing_docs)]
21
22pub mod build;
23mod citizen;
24pub mod codec;
25pub mod cookbook;
26pub mod diff;
27pub mod glance;
28pub mod kinds;
29pub mod model;
30pub mod shapes;
31pub mod text;
32
33pub use build::{
34 Anchor, AnchorSpace, RESERVED_DATA_KEYS, Transform3, anchor, badge, badge_cluster, box_,
35 data_map, gaze_cursor, hand_ray, panel, spatial, stack, stereo, sym, text_node, world_plane,
36};
37pub use citizen::{SceneDescriptor, scene_descriptor_class_symbol};
38pub use codec::{SceneCodec, SceneCodecLib, scene_codec_symbol};
39pub use cookbook::text_node_demo;
40pub use diff::{apply, diff};
41pub use glance::{GLANCE_KIND, GlanceAction, GlanceCard, GlanceMetric, glance_card};
42pub use kinds::{SCENE_KINDS, SCENE_NAMESPACE, is_known_kind, scene_kind};
43pub use model::{SceneError, map, node, node_kind, validate_scene};
44pub use shapes::{scene_shape_specs, scene_shape_symbol};
45
46/// Embedded cookbook recipe books shipped with this library.
47pub static RECIPES: sim_cookbook::EmbeddedDir =
48 include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
49
50#[cfg(test)]
51mod tests;