Skip to main content

sim_lib_view_expr_tree/
lib.rs

1#![forbid(unsafe_code)]
2#![deny(missing_docs)]
3//! Bounded, reversible expression-tree outline over SIM's standard view stack.
4//!
5//! [`ExpressionTreeSurfaceCodec`] implements
6//! [`sim_lib_view::SurfaceCodec`]. Its input is an ordinary
7//! [`ExpressionTreeSnapshot`] value: collapsed nodes carry no fetched child or
8//! face payload, while expanded child pages are either complete or end in an
9//! explicit continuation. The codec projects that one value to desktop and
10//! phone layouts from [`sim_lib_view::SurfaceCaps`], decodes standard Intents,
11//! and commits them to existing `expr-tree/*` operations with their declared
12//! capabilities.
13
14mod budget;
15mod codec;
16mod intent;
17mod model;
18mod scene;
19
20use std::sync::Arc;
21
22use sim_lib_view::LensRegistry;
23
24pub use codec::{
25    EXPRESSION_TREE_SURFACE_CODEC_ID, ExpressionTreeSurfaceCodec,
26    expression_tree_surface_codec_symbol,
27};
28pub use model::{
29    ChildPage, ExpressionTreeSnapshot, FaceSnapshot, FaceState, Freshness, NodeDetail,
30    NodeSnapshot, ReceiptSummary, TimestampSummary,
31};
32
33#[cfg(test)]
34mod tests;
35
36/// Returns the crate's public view-library identity.
37pub const fn crate_identity() -> &'static str {
38    "sim-lib-view-expr-tree"
39}
40
41/// Returns the runtime library identity composed by this view.
42pub fn runtime_identity() -> &'static str {
43    sim_lib_expr_tree::crate_identity()
44}
45
46/// Registers the canonical expression-tree reversible surface in a view
47/// registry.
48///
49/// Browser, phone, and other hosts call this once and then select the stable
50/// [`expression_tree_surface_codec_symbol`] through their generic session bus.
51pub fn register_expression_tree_surface_codec(registry: &mut LensRegistry) {
52    registry.register_surface_codec(
53        expression_tree_surface_codec_symbol(),
54        Arc::new(ExpressionTreeSurfaceCodec::new()),
55    );
56}