pub struct ObservedContext<'a, 'o, C: ContextAccess> { /* private fields */ }Expand description
A ContextAccess wrapper that delegates to an inner ContextAccess
implementor (typically World or the
ContextView routing view) and notifies a
WriteObserver on every mutation.
Generic over the wrapped implementor so it composes with the routing
view: ObservedContext::new(&mut ContextView::new(&mut world, &mut local), observer) observes exactly what the VM sees, regardless of how
many layers the routing view has behind it.
Implementations§
Source§impl<'a, 'o, C: ContextAccess> ObservedContext<'a, 'o, C>
impl<'a, 'o, C: ContextAccess> ObservedContext<'a, 'o, C>
pub fn new(context: &'a mut C, observer: &'o mut dyn WriteObserver) -> Self
Trait Implementations§
Source§impl<C: ContextAccess> ContextAccess for ObservedContext<'_, '_, C>
impl<C: ContextAccess> ContextAccess for ObservedContext<'_, '_, C>
Source§fn take_global(&mut self, idx: u32) -> Value
fn take_global(&mut self, idx: u32) -> Value
Deliberately does not notify the observer: take_global is an
internal RMW implementation detail (the slot transiently holds
Value::Null mid-statement, never a state a host or journal should
ever see — value-model-spec §3’s sharing-unobservable law extends to
this VM-internal bookkeeping too). The RMW’s real semantic write is
the later set_global call that writes the final (mutated, or on a
mid-RMW fault, restored/Null) value back — that one fires
on_set_global exactly as before.
fn global(&self, idx: u32) -> &Value
fn set_global(&mut self, idx: u32, value: Value)
fn visit_count(&self, id: DefinitionId) -> u32
fn increment_visit(&mut self, id: DefinitionId)
Source§fn set_visit_count(&mut self, id: DefinitionId, count: u32)
fn set_visit_count(&mut self, id: DefinitionId, count: u32)
crate::load_state to reconcile a durable save, whose entries carry
absolute counts rather than deltas.fn turn_count(&self, id: DefinitionId) -> Option<u32>
fn set_turn_count(&mut self, id: DefinitionId, turn: u32)
fn turn_index(&self) -> u32
fn increment_turn_index(&mut self)
Source§fn set_turn_index(&mut self, index: u32)
fn set_turn_index(&mut self, index: u32)
crate::load_state to restore a saved turn index.