pub struct DynState { /* private fields */ }Expand description
A dynamic state container that stores values in JSON format.
This is used internally by the runtime to manage state with type-erased channels.
Implementations§
Source§impl DynState
impl DynState
Sourcepub fn from_specs(specs: HashMap<String, ChannelSpec>) -> Self
pub fn from_specs(specs: HashMap<String, ChannelSpec>) -> Self
Create a dynamic state from channel specifications.
Sourcepub fn from_state<S: GraphState>(state: &S) -> Result<Self>
pub fn from_state<S: GraphState>(state: &S) -> Result<Self>
Create a dynamic state from a GraphState instance.
Sourcepub fn to_state<S: GraphState>(&self) -> Result<S>
pub fn to_state<S: GraphState>(&self) -> Result<S>
Convert the dynamic state back to a typed GraphState.
Sourcepub fn get_channel(&self, name: &str) -> Option<&DynChannel>
pub fn get_channel(&self, name: &str) -> Option<&DynChannel>
Get a channel by name.
Sourcepub fn get_channel_mut(&mut self, name: &str) -> Option<&mut DynChannel>
pub fn get_channel_mut(&mut self, name: &str) -> Option<&mut DynChannel>
Get a mutable channel by name.
Sourcepub fn update_channel(&mut self, name: &str, value: Value) -> Result<bool>
pub fn update_channel(&mut self, name: &str, value: Value) -> Result<bool>
Update a channel with a new value.
Sourcepub fn apply_update(&mut self, update: Value) -> Result<()>
pub fn apply_update(&mut self, update: Value) -> Result<()>
Apply a partial update (JSON object with field updates).
Sourcepub fn clear_modified(&mut self)
pub fn clear_modified(&mut self)
Clear the modified flag on all channels (called between super-steps).
Sourcepub fn checkpoint(&self) -> Value
pub fn checkpoint(&self) -> Value
Create a checkpoint of the current state.
Sourcepub fn channel_names(&self) -> impl Iterator<Item = &String>
pub fn channel_names(&self) -> impl Iterator<Item = &String>
Get the list of channel names.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DynState
impl RefUnwindSafe for DynState
impl Send for DynState
impl Sync for DynState
impl Unpin for DynState
impl UnsafeUnpin for DynState
impl UnwindSafe for DynState
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