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
fielddelegates 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::Stringkey (the slice primitive behindfield_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
requiredand the one home for therequired_field(entries, name)forks. Accepts either key form. - extra_
fields - List the field names present in
mapthat are not inknown. 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::Stringkey. Use this for provider-style records (OpenAI, Ollama, MCP) that mix symbol and string keys; usefieldwhen only the bare-symbol form is valid. - field_
bool - Read a bool-valued field (
Expr::Bool). ReturnsNonewhen absent or not a bool. This is the optional counterpart ofrequired_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
TypeMismatcherror labelled withexpected. This is the one home for themap_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_entriesfor 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, matchingfield_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.