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

rlmesh::types::EpisodeState

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

One episode's free state, holding any Send value per key. It lives until the episode ends.

struct EpisodeState

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

Whether key holds a value.

len

method[source]
fn len(&self) -> usize

How many keys hold a value.

is_empty

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

Whether no key holds a value.

Trait implementations

  • impl Default for EpisodeState
  • impl Debug for EpisodeState