pub struct TerminatableTask { /* private fields */ }
Implementations§
Source§impl TerminatableTask
impl TerminatableTask
pub fn create_cancellation_token() -> CancellationToken
Sourcepub fn spawn<F, T>(
rt: ZRuntime,
future: F,
token: CancellationToken,
) -> TerminatableTask
pub fn spawn<F, T>( rt: ZRuntime, future: F, token: CancellationToken, ) -> TerminatableTask
Spawns a task that can be later terminated by TerminatableTask::terminate()
.
Prior to termination attempt the specified cancellation token will be cancelled.
Sourcepub fn spawn_abortable<F, T>(rt: ZRuntime, future: F) -> TerminatableTask
pub fn spawn_abortable<F, T>(rt: ZRuntime, future: F) -> TerminatableTask
Spawns a task that can be later aborted by TerminatableTask::terminate()
.
Sourcepub fn terminate(&mut self, timeout: Duration) -> bool
pub fn terminate(&mut self, timeout: Duration) -> bool
Attempts to terminate the task. Returns true if task completed / aborted within timeout duration, false otherwise.
Sourcepub async fn terminate_async(&mut self)
pub async fn terminate_async(&mut self)
Async version of TerminatableTask::terminate()
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TerminatableTask
impl RefUnwindSafe for TerminatableTask
impl Send for TerminatableTask
impl Sync for TerminatableTask
impl Unpin for TerminatableTask
impl UnwindSafe for TerminatableTask
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