Skip to main content

Crate sim_value

Crate sim_value 

Source
Expand description

Ergonomic construction and access for kernel Expr data.

The kernel Expr enum is bare data with no ergonomic surface. This crate keeps construction, field access, kind labels, immutable updates, and k/i path-addressing helpers in one shared home. It depends only on sim-kernel and adds data ergonomics, not runtime behavior, so it does not touch the kernel boundary.

  • build: constructors (sym, int, float, text, list, map, …);
  • capability_names_from_expr: parses capability-name expressions;
  • access: reading and immutable updates (field, field_any, set, set_strict, remove, …);
  • edit: side-effect-free exact and line-range text edits;
  • kind: the one Expr variant classifier (expr_kind);
  • path: one value-addressing primitive (Path, get, set_at).

§Example

use sim_value::access::{field, set};
use sim_value::build::{int, map, sym};

let value = map(vec![("a", int(1)), ("b", int(2))]);
assert_eq!(field(&value, "a"), Some(&int(1)));

let updated = set(&value, "a", int(9));
assert_eq!(field(&updated, "a"), Some(&int(9)));
assert_eq!(field(&updated, "b"), Some(&int(2))); // siblings preserved
let _ = sym("ok");

Re-exports§

pub use capability::capability_names_from_expr;

Modules§

access
Reading and immutable updates for kernel Expr data.
build
Constructors for kernel Expr data.
capability
Capability-name readers for Expr data.
edit
Side-effect-free text edit primitives.
kind
The one Expr variant classifier.
path
One value-addressing primitive over Expr.