Skip to main content

Debuggee

Struct Debuggee 

Source
pub struct Debuggee<T: Send + 'static> { /* private fields */ }
Expand description

A Debuggee 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 Debuggee::run.

Implementations§

Source§

impl<T: Send + 'static> Debuggee<T>

Source

pub fn new<F>(store: Store<T>, inner: F) -> Debuggee<T>
where F: for<'a> FnOnce(&'a mut Store<T>) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>> + Send + 'static,

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 Debuggee::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 Debuggee and hence no other methods can be invoked.

When paused, the holder of this object can access the Store indirectly by providing a closure

Source

pub fn is_complete(&self) -> bool

Is the inner body done running?

Source

pub fn engine(&self) -> &Engine

Get the Engine associated with the debuggee.

Source

pub fn interrupt_pending(&self) -> &Arc<AtomicBool>

Get the interrupt-pending flag. Setting this to true causes the next epoch yield to surface as an Interrupted event.

Source

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.

Source

pub async fn finish(&mut self) -> Result<()>

Run the debugger body until completion, with no further events.

Source

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 Debuggee 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.

Auto Trait Implementations§

§

impl<T> Freeze for Debuggee<T>

§

impl<T> !RefUnwindSafe for Debuggee<T>

§

impl<T> Send for Debuggee<T>

§

impl<T> Sync for Debuggee<T>
where T: Sync,

§

impl<T> Unpin for Debuggee<T>

§

impl<T> UnsafeUnpin for Debuggee<T>

§

impl<T> !UnwindSafe for Debuggee<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetSetFdFlags for T

Source§

fn get_fd_flags(&self) -> Result<FdFlags, Error>
where T: AsFilelike,

Query the “status” flags for the self file descriptor.
Source§

fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>
where T: AsFilelike,

Create a new SetFdFlags value for use with set_fd_flags. Read more
Source§

fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>
where T: AsFilelike,

Set the “status” flags for the self file descriptor. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T