pub trait WriteObserver {
// Provided methods
fn on_set_global(&mut self, idx: u32, value: &Value) { ... }
fn on_increment_visit(&mut self, id: DefinitionId, new_count: u32) { ... }
fn on_set_turn_count(&mut self, id: DefinitionId, turn: u32) { ... }
fn on_increment_turn_index(&mut self, new_value: u32) { ... }
fn on_set_rng_seed(&mut self, new_seed: i32) { ... }
fn on_set_previous_random(&mut self, new_val: i32) { ... }
}Expand description
Observer for state mutations during story execution.
Implement this trait to intercept every write the VM makes to the story state. All methods have default no-op implementations. The observer receives the new value only — no old-value cloning is performed.
Provided Methods§
fn on_set_global(&mut self, idx: u32, value: &Value)
fn on_increment_visit(&mut self, id: DefinitionId, new_count: u32)
fn on_set_turn_count(&mut self, id: DefinitionId, turn: u32)
fn on_increment_turn_index(&mut self, new_value: u32)
fn on_set_rng_seed(&mut self, new_seed: i32)
fn on_set_previous_random(&mut self, new_val: i32)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".