Skip to main content

Module access

Module access 

Source
Expand description

Reading and immutable updates for kernel Expr data.

field matches an unqualified symbol key equal to name – the existing majority behavior across the repo. field_q covers qualified keys. The split prevents a silent behavior change for callers that relied on either form. set/remove are immutable (clone, then modify) to match every current caller.

Functions§

as_f64
Read a number value’s canonical literal as f64.
as_i64
Read a number value’s canonical literal as i64.
as_str
Borrow a string value’s contents.
entry_field
Look up an unqualified-keyed field in a map’s entry slice. The slice-level primitive field delegates to; use it when a caller already holds the &[(Expr, Expr)] entries (provider codecs, MCP) instead of rebuilding a map.
entry_field_any
Look up a field in an entry slice, accepting a bare-symbol OR Expr::String key (the slice primitive behind field_any).
entry_required
Look up a required field in a map’s entry slice, with a context-labeled error when missing. The slice analog of required and the one home for the required_field(entries, name) forks. Accepts either key form.
extra_fields
List the field names present in map that are not in known. Keys that are neither bare symbols nor strings are ignored. Use this for open-record validation (reject or warn on unexpected fields).
field
Look up an unqualified-keyed field by name.
field_any
Look up a field by name, accepting either a bare-symbol key or an Expr::String key. Use this for provider-style records (OpenAI, Ollama, MCP) that mix symbol and string keys; use field when only the bare-symbol form is valid.
field_bool
Read a bool-valued field (Expr::Bool). Returns None when absent or not a bool. This is the optional counterpart of required_bool.
field_f64
Read a float-valued field.
field_i64
Read an integer-valued field.
field_q
Look up a qualified-keyed field by namespace and name.
field_str
Read a string-valued field.
field_sym
Read a symbol-valued field.
map_entries
Borrow a map value’s entries, or return a TypeMismatch error labelled with expected. This is the one home for the map_fields(expr, "...") helper that MCP, skill, and codec crates each re-grew.
remove
Remove an unqualified-keyed field, returning a new map value.
required
Look up a required field, returning a context-labeled error when it is missing. Accepts either key form, matching field_any.
required_bool
Read a required bool-valued field (Expr::Bool), with a context label.
required_map
Borrow a required map-valued field’s entries, with a context label. This is the context-carrying counterpart of map_entries for a named field.
required_str
Read a required string-valued field, with a context label for diagnostics. This is the one home for the string_field/required_field-style readers that coerce to &str; callers wanting a domain-specific error keep a thin local wrapper. Accepts either key form, matching field_any.
required_sym
Read a required symbol-valued field, with a context label for diagnostics.
set
Set (or insert) an unqualified-keyed field, preserving sibling keys, in a new map value.