Skip to main content

sim_table_core/
lib.rs

1//! Shared table substrate: path validation, path-reference resolution, and the
2//! table operation protocol.
3//!
4//! Table backends (`sim-table-db`, `sim-table-remote`, ...) share one
5//! path-segment predicate, one absolute/relative reference syntax, and one
6//! `table/<op>` call protocol on the wire. This crate is the home for all three:
7//!
8//! - [`capabilities`]: canonical fs/find/edit/exec/net capability names and
9//!   compatibility alias checks for host-effect call sites;
10//! - [`path`]: the legal-segment predicate ([`is_legal_table_segment`]) and a
11//!   small [`TablePath`] accumulator that validates as it grows, plus
12//!   [`TablePathRef`] for escaped absolute and relative references;
13//! - [`op`]: the [`TableOp`] model plus [`encode_table_op`]/[`decode_table_op`],
14//!   which round-trip through the kernel `Expr` graph using the exact wire
15//!   spellings that `sim-table-remote` already speaks.
16//!
17//! It depends only on `sim-kernel` and `sim-value`, adding data ergonomics and
18//! protocol shape rather than runtime behavior, so it does not touch the kernel
19//! boundary.
20//!
21//! # Example
22//!
23//! ```
24//! use sim_table_core::is_legal_table_segment;
25//!
26//! assert!(is_legal_table_segment("nodes"));
27//! assert!(!is_legal_table_segment("")); // empty
28//! assert!(!is_legal_table_segment("..")); // parent escape
29//! assert!(!is_legal_table_segment("a/b")); // path separator
30//! ```
31
32#![forbid(unsafe_code)]
33#![deny(missing_docs)]
34
35pub mod capabilities;
36pub mod citizen_fields;
37pub mod manifest;
38pub mod op;
39pub mod path;
40
41pub use manifest::backend_manifest;
42pub use op::{TableOp, TableOpError, decode_table_op, encode_table_op};
43pub use path::{
44    MAX_TABLE_PATH_SEGMENTS, MAX_TABLE_PATH_TEXT_BYTES, TablePath, TablePathError, TablePathRef,
45    TablePathRefError, TablePathRefPart, is_legal_table_segment,
46};
47
48#[cfg(test)]
49mod tests;