rlmesh::types::EpisodeState
One episode's free state, holding any Send value per key. It lives until the episode ends.
struct EpisodeStateMethods
- get()The value under
key, if present and aT. - get_mut()The value under
key, mutably, if present and aT. - insert()Store
valueunderkey; the value it replaced, if any. - get_or_insert_with()The
Tunderkey, insertingf()when the key is missing. - remove()Remove the value under
key. - contains_key()Whether
keyholds a value. - len()How many keys hold a value.
- is_empty()Whether no key holds a value.
get
method[source]fn get<T: Any>(&self, key: &str) -> Option<&T>The value under key, if present and a T.
get_mut
method[source]fn get_mut<T: Any>(&mut self, key: &str) -> Option<&mut T>The value under key, mutably, if present and a T.
insert
method[source]fn insert<T: Any + Send>(
&mut self,
key: impl Into<String>,
value: T,
) -> Option<Box<dyn Any + Send>>Store value under key; the value it replaced, if any.
get_or_insert_with
method[source]fn get_or_insert_with<T: Any + Send>(
&mut self,
key: &str,
f: impl FnOnce() -> T,
) -> Result<&mut T>The T under key, inserting f() when the key is missing. A key
holding another type is the TypeError class naming it.
remove
method[source]fn remove(&mut self, key: &str) -> Option<Box<dyn Any + Send>>Remove the value under key.
contains_key
method[source]fn contains_key(&self, key: &str) -> boolWhether key holds a value.
len
method[source]fn len(&self) -> usizeHow many keys hold a value.
is_empty
method[source]fn is_empty(&self) -> boolWhether no key holds a value.
Trait implementations
- impl Default for EpisodeState
- impl Debug for EpisodeState