pub struct Debugger<T: Send + 'static> { /* private fields */ }Expand description
A Debugger wraps up state associated with debugging the code
running in a single Store.
It acts as a Future combinator, wrapping an inner async body that
performs some actions on a store. Those actions are subject to the
debugger, and debugger events will be raised as appropriate. From
the “outside” of this combinator, it is always in one of two
states: running or paused. When paused, it acts as a
StoreContextMut and can allow examining the paused execution’s
state. One runs until the next event suspends execution by
invoking Debugger::run.
Implementations§
Source§impl<T: Send + 'static> Debugger<T>
impl<T: Send + 'static> Debugger<T>
Sourcepub fn new<F, I>(store: Store<T>, inner: F) -> Debugger<T>
pub fn new<F, I>(store: Store<T>, inner: F) -> Debugger<T>
Create a new Debugger that attaches to the given Store and runs the given inner body.
The debugger is always in one of two states: running or paused.
When paused, the holder of this object can invoke
Debugger::run to enter the running state. The inner body
will run until paused by a debug event. While running, the
future returned by either of these methods owns the Debugger
and hence no other methods can be invoked.
When paused, the holder of this object can access the Store
indirectly by providing a closure
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Is the inner body done running?
Sourcepub async fn run(&mut self) -> Result<DebugRunResult>
pub async fn run(&mut self) -> Result<DebugRunResult>
Run the inner body until the next debug event.
This method is cancel-safe, and no events will be lost.
Sourcepub async fn finish(&mut self) -> Result<()>
pub async fn finish(&mut self) -> Result<()>
Run the debugger body until completion, with no further events.
Sourcepub async fn with_store<F: FnOnce(StoreContextMut<'_, T>) -> R + Send + 'static, R: Send + 'static>(
&mut self,
f: F,
) -> Result<R>
pub async fn with_store<F: FnOnce(StoreContextMut<'_, T>) -> R + Send + 'static, R: Send + 'static>( &mut self, f: F, ) -> Result<R>
Perform some action on the contained Store while not running.
This may only be invoked before the inner body finishes and
when it is paused; that is, when the Debugger is initially
created and after any call to run() returns a result other
than DebugRunResult::Finished. If an earlier run()
invocation was canceled, it must be re-invoked and return
successfully before a query is made.
This is cancel-safe; if canceled, the result of the query will be dropped.
Sourcepub async fn take_store(&mut self) -> Result<Option<Store<T>>>
pub async fn take_store(&mut self) -> Result<Option<Store<T>>>
Drop the Debugger once complete, returning the inner Store
around which it was wrapped.
Only valid to invoke once run() returns
DebugRunResult::Finished or after calling finish() (which
finishes execution while dropping all further debug events).
This is cancel-safe, but if canceled, the Store is lost.