pub trait Map: Reflect {
fn get(
&self,
key: &(dyn Reflect + 'static)
) -> Option<&(dyn Reflect + 'static)>;
fn get_mut(
&mut self,
key: &(dyn Reflect + 'static)
) -> Option<&mut (dyn Reflect + 'static)>;
fn get_at(
&self,
index: usize
) -> Option<(&(dyn Reflect + 'static), &(dyn Reflect + 'static))>;
fn len(&self) -> usize;
fn iter(&self) -> MapIter<'_>ⓘNotable traits for MapIter<'a>impl<'a> Iterator for MapIter<'a> type Item = (&'a (dyn Reflect + 'static), &'a (dyn Reflect + 'static));
;
fn clone_dynamic(&self) -> DynamicMap;
fn is_empty(&self) -> bool { ... }
}
Expand description
An ordered mapping between Reflect
values.
Because the values are reflected, the underlying types of keys and values may differ between entries.
ReflectValue
Keys
are assumed to return a non-None
hash. The ordering
of Map
entries is not guaranteed to be stable across runs or between
instances.
This trait corresponds to types like std::collections::HashMap
.
Required Methods
Returns a reference to the value associated with the given key.
If no value is associated with key
, returns None
.
Returns a mutable reference to the value associated with the given key.
If no value is associated with key
, returns None
.
Returns the key-value pair at index
by reference, or None
if out of bounds.
Returns an iterator over the key-value pairs of the map.
fn clone_dynamic(&self) -> DynamicMap
fn clone_dynamic(&self) -> DynamicMap
Clones the map, producing a DynamicMap
.