Struct respo::StatesTree
source · pub struct StatesTree {
pub data: MaybeState,
pub cursor: Vec<String>,
pub branches: HashMap<String, Box<StatesTree>>,
}
Expand description
Respo maintains states in a tree structure, where the keys are strings, each child component “picks” a key to attach its own state to the tree, and it dispatches events to global store to update the state.
Fields§
§data: MaybeState
local data
cursor: Vec<String>
the path to the current state in the tree, use in updating
branches: HashMap<String, Box<StatesTree>>
holding children states
Implementations§
source§impl StatesTree
impl StatesTree
sourcepub fn pick(&self, name: &str) -> StatesTree
pub fn pick(&self, name: &str) -> StatesTree
pick a child branch as new cursor
sourcepub fn set_in_mut(&mut self, path: &[String], new_state: MaybeState)
pub fn set_in_mut(&mut self, path: &[String], new_state: MaybeState)
in-place mutation of state tree
Trait Implementations§
source§impl Clone for StatesTree
impl Clone for StatesTree
source§fn clone(&self) -> StatesTree
fn clone(&self) -> StatesTree
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for StatesTree
impl Debug for StatesTree
source§impl Default for StatesTree
impl Default for StatesTree
source§fn default() -> StatesTree
fn default() -> StatesTree
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for StatesTree
impl<'de> Deserialize<'de> for StatesTree
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<StatesTree> for StatesTree
impl PartialEq<StatesTree> for StatesTree
source§fn eq(&self, other: &StatesTree) -> bool
fn eq(&self, other: &StatesTree) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for StatesTree
impl Serialize for StatesTree
impl Eq for StatesTree
impl StructuralEq for StatesTree
impl StructuralPartialEq for StatesTree
Auto Trait Implementations§
impl RefUnwindSafe for StatesTree
impl Send for StatesTree
impl Sync for StatesTree
impl Unpin for StatesTree
impl UnwindSafe for StatesTree
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more