rlmesh::spaces::Dict
Named child spaces.
struct Dict(/* private field */)Read it as a mapping in the spec’s declaration order (a Dict built here sorts its keys; a remote spec keeps its own order). Each child is a space of its own with its own sampler, shared by every handle of this Dict: seeding or sampling the Dict leaves them alone.
Associated functions
Methods
- spaces()The children as a read-only mapping.
- keys()The keys, in declaration order.
- values()The child spaces, in declaration order.
- items()The
(key, space)pairs, in declaration order. - iter()The keys in declaration order.
- get()The child space at
key(d[key]), orNone. - len()The number of children (
len(d)). - contains_key()Whether
keynames a child (key in d).
from_spec
associated function[source]fn from_spec(spec: SpaceSpec) -> Result<Self>A space for spec; a spec of another kind is the ValueError
class.
new
associated function[source]fn new<K: Into<String>, S: Into<SpaceSpec>>(
spaces: impl IntoIterator<Item = (K, S)>,
) -> Result<Dict>Dict(spaces): each child’s spec is copied into a fresh child space.
A duplicate or empty key is the ValueError class.
spaces
method[source]fn spaces(&self) -> &DictSpacesThe children as a read-only mapping.
keys
method[source]fn keys(&self) -> DictKeys<'_>The keys, in declaration order.
values
method[source]fn values(&self) -> DictValues<'_>The child spaces, in declaration order.
items
method[source]fn items(&self) -> DictItems<'_>The (key, space) pairs, in declaration order.
iter
method[source]fn iter(&self) -> DictKeys<'_>The keys in declaration order.
get
method[source]fn get(&self, key: &str) -> Option<&Space>The child space at key (d[key]), or None.
len
method[source]fn len(&self) -> usizeThe number of children (len(d)).
contains_key
method[source]fn contains_key(&self, key: &str) -> boolWhether key names a child (key in d).
Trait implementations
- impl Clone for Dict
- impl Deref for Dict
- impl Display for Dict
- impl Debug for Dict
- impl PartialEq for Dict
- impl PartialEq<Space> for Dict
- impl PartialEq<Dict> for Space
- impl From<Dict> for Space
- impl From<Dict> for SpaceSpec
- impl From<&Dict> for SpaceSpec
- impl TryFrom<Space> for Dict
- impl Index<&str> for Dict
- impl<'a> IntoIterator for &'a Dict