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§
fn count(&self) -> usize
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)
Sourcefn insert_filled(
&mut self,
key: String,
fill: &mut dyn FnMut(&mut dyn Any) -> Result<(), ModelError>,
) -> Result<(), ModelError>
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.
Sourcefn insert_moved(
&mut self,
key: String,
staged: &mut dyn Any,
) -> Result<(), ModelError>
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§
Sourcefn differing_keys<'a>(&'a self, before: &'a dyn Any) -> Option<Vec<&'a str>>
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".