pub struct MapVal { /* private fields */ }Expand description
A Soil map: entries kept sorted by the carried order (a sorted vec by resolved decision; swap for a tree behind this API only if profiling demands it — plan 01).
Operations take the Runtime because the
structural order consults the registry, and they are fallible
because a custom comparator is a Soil closure. A comparator that is
not a total order silently corrupts the sorted invariant; detecting
that is the refinement checker’s job, not the runtime’s (impl plan
§7). The order is structure, not content: derived eq/compare
look only at the entries.
Implementations§
Source§impl MapVal
impl MapVal
pub fn new(order: MapOrder) -> Self
pub fn order(&self) -> &MapOrder
Sourcepub fn entries(&self) -> &[(Value, Value)]
pub fn entries(&self) -> &[(Value, Value)]
Entries in comparator order — the order show and JSON emit.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get( &self, runtime: &Runtime, key: &Value, ) -> Result<Option<&Value>, SoilError>
Sourcepub fn insert(
&mut self,
runtime: &Runtime,
key: Value,
value: Value,
) -> Result<(), SoilError>
pub fn insert( &mut self, runtime: &Runtime, key: Value, value: Value, ) -> Result<(), SoilError>
Insert or replace. Mutation is a construction-time affair: a
MapVal already shared inside a Value::Map is immutable, and
Soil-level insertion clones the map (no mutation, design §3.13).