pub struct Stoppable { /* private fields */ }Expand description
Shared stop flag passed via Context::stoppable.
Cloneable, thread-safe. Setting it asks the executor to terminate the
run loop after the current iteration completes — and, if the handle
was bound to a running executor, also wakes the WaitSet immediately.
Implementations§
Source§impl Stoppable
impl Stoppable
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a fresh, un-stopped handle with no wakeup wired.
Useful for tests; the executor uses with_waker to bind a notifier.
Sourcepub fn stop(&self)
pub fn stop(&self)
Request stop. Flips the flag (Release) and, if a waker was bound,
notifies the WaitSet so it returns from wait_and_process promptly.
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Check whether stop has been requested.
Trait Implementations§
impl Send for Stoppable
Auto Trait Implementations§
impl Freeze for Stoppable
impl !RefUnwindSafe for Stoppable
impl !Sync for Stoppable
impl Unpin for Stoppable
impl UnsafeUnpin for Stoppable
impl !UnwindSafe for Stoppable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more