pub struct ServiceTaskContext { /* private fields */ }Expand description
Control handle passed to ServiceTask::run.
Implementations§
Source§impl ServiceTaskContext
impl ServiceTaskContext
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a context that is not stopped and has no pending wakeup.
ServiceManager creates the context it passes to ServiceTask::run;
this constructor lets a test drive a service loop directly.
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Returns whether this run was asked to stop, or was replaced by a newer run.
Sourcepub async fn wait_for_running(&self, interval: Duration) -> bool
pub async fn wait_for_running(&self, interval: Duration) -> bool
Waits until woken up or until interval elapses.
Returns at once when a wakeup is already pending. Always returns
true, after which the loop does its on_wait_end work.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ServiceTaskContext
impl Freeze for ServiceTaskContextwhere
*const ArcInner<ServiceSignals> is !null: Freeze,
PhantomData<ArcInner<ServiceSignals>>: Freeze,
impl Move for ServiceTaskContext
impl RefUnwindSafe for ServiceTaskContextwhere
Atomic<usize>: RefUnwindSafe,
Atomic<u64>: RefUnwindSafe,
Atomic<bool>: RefUnwindSafe,
Notify: RefUnwindSafe,
impl Send for ServiceTaskContext
impl Sync for ServiceTaskContext
impl Unpin for ServiceTaskContext
impl UnsafeUnpin for ServiceTaskContextwhere
*const ArcInner<ServiceSignals> is !null: UnsafeUnpin,
PhantomData<ArcInner<ServiceSignals>>: UnsafeUnpin,
impl UnwindSafe for ServiceTaskContextwhere
Arc<ServiceSignals>: UnwindSafe,
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