Skip to main content

MapEntries

Trait MapEntries 

Source
pub trait MapEntries {
    // Required methods
    fn count(&self) -> usize;
    fn each(&self, visit: &mut dyn FnMut(&str, &dyn Any));
    fn value(&self, key: &str) -> Option<&dyn Any>;
    fn value_mut(&mut self, key: &str) -> Option<&mut dyn Any>;
    fn remove_key(&mut self, key: &str);
    fn insert_filled(
        &mut self,
        key: String,
        fill: &mut dyn FnMut(&mut dyn Any) -> Result<(), ModelError>,
    ) -> Result<(), ModelError>;
    fn insert_moved(
        &mut self,
        key: String,
        staged: &mut dyn Any,
    ) -> Result<(), ModelError>;

    // Provided method
    fn differing_keys<'a>(&'a self, before: &'a dyn Any) -> Option<Vec<&'a str>> { ... }
}
Expand description

A map’s entries, whatever their value type.

Required Methods§

Source

fn count(&self) -> usize

Source

fn each(&self, visit: &mut dyn FnMut(&str, &dyn Any))

Each entry in key order.

Source

fn value(&self, key: &str) -> Option<&dyn Any>

Source

fn value_mut(&mut self, key: &str) -> Option<&mut dyn Any>

Source

fn remove_key(&mut self, key: &str)

Source

fn insert_filled( &mut self, key: String, fill: &mut dyn FnMut(&mut dyn Any) -> Result<(), ModelError>, ) -> Result<(), ModelError>

Insert (or replace) key, its value put by fill into an Option of the value type.

§Errors

What fill refused.

Source

fn insert_moved( &mut self, key: String, staged: &mut dyn Any, ) -> Result<(), ModelError>

Insert (or replace) key with the value moved out of staged, a filled Option of the value type.

§Errors

When staged is of another type or empty.

Provided Methods§

Source

fn differing_keys<'a>(&'a self, before: &'a dyn Any) -> Option<Vec<&'a str>>

The keys whose entries may differ from those of before, a map of this same type, in key order, once each: under any other key both hold the same entry. None, the default, when the map cannot tell, and every entry is compared.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: 'static> MapEntries for BTreeMap<String, T>

Source§

fn count(&self) -> usize

Source§

fn each(&self, visit: &mut dyn FnMut(&str, &dyn Any))

Source§

fn value(&self, key: &str) -> Option<&dyn Any>

Source§

fn value_mut(&mut self, key: &str) -> Option<&mut dyn Any>

Source§

fn remove_key(&mut self, key: &str)

Source§

fn insert_filled( &mut self, key: String, fill: &mut dyn FnMut(&mut dyn Any) -> Result<(), ModelError>, ) -> Result<(), ModelError>

Source§

fn insert_moved( &mut self, key: String, staged: &mut dyn Any, ) -> Result<(), ModelError>

Implementors§

Source§

impl<T: 'static> MapEntries for Map<T>