rlmesh::types::Metadata
An insertion-ordered string → Value map.
struct Metadata(/* private field */)Iteration follows insertion order; lookup and equality ignore order.
insert on an existing key replaces the value in place
and keeps its position; remove keeps the order of the
remaining keys; collecting pairs with a repeated key keeps the first
position and the last value.
Also available as rlmesh::Metadata.
Associated functions
Methods
- get()The value at
key. - get_mut()The value at
key, mutably. - contains_key()Whether
keyis present (key in d). - insert()Set
key(d[key] = value), returning the value it replaced. - remove()Remove
key(d.pop(key, None)), keeping the order of the rest. - iter()The entries in insertion order.
- keys()The keys in insertion order.
- values()The values in insertion order.
- len()The number of entries.
- is_empty()Whether the map is empty.
new
associated function[source]fn new() -> MetadataAn empty map.
get
method[source]fn get(&self, key: &str) -> Option<&Value>The value at key.
get_mut
method[source]fn get_mut(&mut self, key: &str) -> Option<&mut Value>The value at key, mutably.
contains_key
method[source]fn contains_key(&self, key: &str) -> boolWhether key is present (key in d).
insert
method[source]fn insert(
&mut self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Option<Value>Set key (d[key] = value), returning the value it replaced. An
existing key keeps its position.
remove
method[source]fn remove(&mut self, key: &str) -> Option<Value>Remove key (d.pop(key, None)), keeping the order of the rest.
iter
method[source]fn iter(&self) -> MetadataIter<'_>The entries in insertion order.
keys
method[source]fn keys(&self) -> impl ExactSizeIterator<Item = &str> + '_The keys in insertion order.
values
method[source]fn values(&self) -> impl ExactSizeIterator<Item = &Value> + '_The values in insertion order.
len
method[source]fn len(&self) -> usizeThe number of entries.
is_empty
method[source]fn is_empty(&self) -> boolWhether the map is empty.
Trait implementations
- impl From<Metadata> for Value
- impl Clone for Metadata
- impl Debug for Metadata
- impl Default for Metadata
- impl PartialEq for Metadata
- impl<K: Into<String>, V: Into<Value>> FromIterator<(K, V)> for Metadata
- impl IntoIterator for Metadata
- impl<'a> IntoIterator for &'a Metadata