This reference describes unreleased code on main; no release documents it yet.

rlmesh::types::Metadata

structPreviewuse rlmesh::types::Metadata;[source]

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.

new

associated function[source]
fn new() -> Metadata

An 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) -> bool

Whether 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) -> usize

The number of entries.

is_empty

method[source]
fn is_empty(&self) -> bool

Whether 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