sim_table_core/lib.rs
1//! Shared table substrate: path validation and the table operation protocol.
2//!
3//! Table backends (`sim-table-db`, `sim-table-remote`, ...) independently grew
4//! the same path-segment validation predicate and an ad-hoc `table/<op>` call
5//! protocol on the wire. This crate is the one home for both:
6//!
7//! - [`path`]: the legal-segment predicate ([`is_legal_table_segment`]) and a
8//! small [`TablePath`] accumulator that validates as it grows;
9//! - [`op`]: the [`TableOp`] model plus [`encode_table_op`]/[`decode_table_op`],
10//! which round-trip through the kernel `Expr` graph using the exact wire
11//! spellings that `sim-table-remote` already speaks.
12//!
13//! It depends only on `sim-kernel` and `sim-value`, adding data ergonomics and
14//! protocol shape rather than runtime behavior, so it does not touch the kernel
15//! boundary.
16//!
17//! # Example
18//!
19//! ```
20//! use sim_table_core::is_legal_table_segment;
21//!
22//! assert!(is_legal_table_segment("nodes"));
23//! assert!(!is_legal_table_segment("")); // empty
24//! assert!(!is_legal_table_segment("..")); // parent escape
25//! assert!(!is_legal_table_segment("a/b")); // path separator
26//! ```
27
28#![forbid(unsafe_code)]
29#![deny(missing_docs)]
30
31pub mod citizen_fields;
32pub mod op;
33pub mod path;
34
35pub use op::{TableOp, TableOpError, decode_table_op, encode_table_op};
36pub use path::{TablePath, TablePathError, is_legal_table_segment};
37
38#[cfg(test)]
39mod tests;