pub struct WatchpointObserver { /* private fields */ }Expand description
A WriteObserver that watches a fixed set of global slot indices and
records a hit whenever one is written — the entire watchpoint
implementation. Reuses the existing production WriteObserver/
ObservedContext seam (state.rs) rather than a second observer
mechanism, per the issue’s own instruction: this struct is the only
piece of new plumbing watchpoints need.
Composes with crate::Story::debug_run_watching for pausing
mid-step-loop on a hit, or with the existing
Story::continue_single_observed (unaffected by this feature) for
production-path logging without pausing — the observer doesn’t care
which loop drives it.
Implementations§
Source§impl WatchpointObserver
impl WatchpointObserver
pub fn new(watched_globals: Vec<u32>) -> Self
pub fn watches(&self, global_idx: u32) -> bool
Sourcepub fn take_hits(&mut self) -> Vec<WatchHit>
pub fn take_hits(&mut self) -> Vec<WatchHit>
Drain every hit recorded since the last take_hits/clear call, in
the order they were recorded. The public counterpart to take_hit
— for a consumer that composes this observer with
Story::continue_single_observed/continue_maximally_observed
(non-pausing logging, per this module’s doc), take_hit’s
pub(crate) FIFO pop is not reachable from outside the crate, so
without this method pending would accumulate for the observer’s
entire lifetime with no way for a consumer to clear it — the
unbounded-growth guard this method (and clear) close.
Trait Implementations§
Source§impl Clone for WatchpointObserver
impl Clone for WatchpointObserver
Source§fn clone(&self) -> WatchpointObserver
fn clone(&self) -> WatchpointObserver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more