Skip to main content

MapVal

Struct MapVal 

Source
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

Source

pub fn new(order: MapOrder) -> Self

Source

pub fn order(&self) -> &MapOrder

Source

pub fn entries(&self) -> &[(Value, Value)]

Entries in comparator order — the order show and JSON emit.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn get( &self, runtime: &Runtime, key: &Value, ) -> Result<Option<&Value>, SoilError>

Source

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).

Source

pub fn remove( &mut self, runtime: &Runtime, key: &Value, ) -> Result<Option<Value>, SoilError>

Trait Implementations§

Source§

impl Debug for MapVal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for MapVal

§

impl !RefUnwindSafe for MapVal

§

impl !Send for MapVal

§

impl !Sync for MapVal

§

impl Unpin for MapVal

§

impl UnsafeUnpin for MapVal

§

impl !UnwindSafe for MapVal

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.