sim-lib-view-expr-tree 0.2.0

Bounded reversible SurfaceCodec for SIM expression-tree outlines.
Documentation
#![forbid(unsafe_code)]
#![deny(missing_docs)]
//! Bounded, reversible expression-tree outline over SIM's standard view stack.
//!
//! [`ExpressionTreeSurfaceCodec`] implements
//! [`sim_lib_view::SurfaceCodec`]. Its input is an ordinary
//! [`ExpressionTreeSnapshot`] value: collapsed nodes carry no fetched child or
//! face payload, while expanded child pages are either complete or end in an
//! explicit continuation. The codec projects that one value to desktop and
//! phone layouts from [`sim_lib_view::SurfaceCaps`], decodes standard Intents,
//! and commits them to existing `expr-tree/*` operations with their declared
//! capabilities.

mod budget;
mod codec;
mod intent;
mod model;
mod scene;

use std::sync::Arc;

use sim_lib_view::LensRegistry;

pub use codec::{
    EXPRESSION_TREE_SURFACE_CODEC_ID, ExpressionTreeSurfaceCodec,
    expression_tree_surface_codec_symbol,
};
pub use model::{
    ChildPage, ExpressionTreeSnapshot, FaceSnapshot, FaceState, Freshness, NodeDetail,
    NodeSnapshot, ReceiptSummary, TimestampSummary,
};

#[cfg(test)]
mod tests;

/// Returns the crate's public view-library identity.
pub const fn crate_identity() -> &'static str {
    "sim-lib-view-expr-tree"
}

/// Returns the runtime library identity composed by this view.
pub fn runtime_identity() -> &'static str {
    sim_lib_expr_tree::crate_identity()
}

/// Registers the canonical expression-tree reversible surface in a view
/// registry.
///
/// Browser, phone, and other hosts call this once and then select the stable
/// [`expression_tree_surface_codec_symbol`] through their generic session bus.
pub fn register_expression_tree_surface_codec(registry: &mut LensRegistry) {
    registry.register_surface_codec(
        expression_tree_surface_codec_symbol(),
        Arc::new(ExpressionTreeSurfaceCodec::new()),
    );
}