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 Freeze for ServiceTaskContext
impl RefUnwindSafe for ServiceTaskContext
impl Send for ServiceTaskContext
impl Sync for ServiceTaskContext
impl Unpin for ServiceTaskContext
impl UnsafeUnpin for ServiceTaskContext
impl UnwindSafe for ServiceTaskContext
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