pub struct StateCommand {
pub patch: MutationBatch,
pub scheduled_actions: Vec<ScheduledAction>,
pub effects: Vec<TypedEffect>,
}Expand description
A command that carries state mutations, scheduled actions, and effects.
This is the primary mechanism for both plugin hooks and tools to express
side-effects. Plugins return StateCommand from phase hooks; tools return
it alongside ToolResult to declare their side-effects using the same
machinery.
Fields§
§patch: MutationBatch§scheduled_actions: Vec<ScheduledAction>§effects: Vec<TypedEffect>Implementations§
Source§impl StateCommand
impl StateCommand
pub fn new() -> StateCommand
pub fn with_base_revision(self, revision: u64) -> StateCommand
pub fn is_empty(&self) -> bool
Sourcepub fn scheduled_actions(&self) -> &[ScheduledAction]
pub fn scheduled_actions(&self) -> &[ScheduledAction]
Inspect scheduled actions (useful for testing).
pub fn emit<E>(
&mut self,
payload: <E as EffectSpec>::Payload,
) -> Result<(), StateError>where
E: EffectSpec,
pub fn schedule_action<A>(
&mut self,
payload: <A as ScheduledActionSpec>::Payload,
) -> Result<(), StateError>where
A: ScheduledActionSpec,
pub fn extend(&mut self, other: StateCommand) -> Result<(), StateError>
Sourcepub fn merge_parallel<F>(
self,
other: StateCommand,
strategy: F,
) -> Result<StateCommand, StateError>
pub fn merge_parallel<F>( self, other: StateCommand, strategy: F, ) -> Result<StateCommand, StateError>
Merge two commands from parallel execution using the given merge strategy.
Methods from Deref<Target = MutationBatch>§
pub fn base_revision(&self) -> Option<u64>
pub fn is_empty(&self) -> bool
pub fn update<K>(&mut self, update: <K as StateKey>::Update)where
K: StateKey,
pub fn clear_extension_with( &mut self, key: impl Into<String>, clear: fn(&mut StateMap), )
pub fn extend(&mut self, other: MutationBatch) -> Result<(), StateError>
pub fn op_len(&self) -> usize
Trait Implementations§
Source§impl Debug for StateCommand
impl Debug for StateCommand
Source§impl Default for StateCommand
impl Default for StateCommand
Source§fn default() -> StateCommand
fn default() -> StateCommand
Returns the “default value” for a type. Read more
Source§impl Deref for StateCommand
impl Deref for StateCommand
Source§type Target = MutationBatch
type Target = MutationBatch
The resulting type after dereferencing.
Source§impl DerefMut for StateCommand
impl DerefMut for StateCommand
Auto Trait Implementations§
impl Freeze for StateCommand
impl !RefUnwindSafe for StateCommand
impl Send for StateCommand
impl !Sync for StateCommand
impl Unpin for StateCommand
impl UnsafeUnpin for StateCommand
impl !UnwindSafe for StateCommand
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