pub struct TaskLease { /* private fields */ }Expand description
A task whose holder says how it ended: registered on creation, ended by
conclude. One dropped without concluding — its work
panicked, was dropped from a queue, or its holder simply went away — ends
as stopped, and the parent hears so when the lease was taken
notifying it. No task held by a lease is left running.
Implementations§
Source§impl TaskLease
impl TaskLease
pub fn new( session: Arc<dyn Session>, task_id: impl Into<String>, task_type: TaskType, cancel: CancellationToken, detail: Value, ) -> Self
Sourcepub fn notifying(
self,
notice: impl Fn(&RunningTask) -> String + Send + Sync + 'static,
) -> Self
pub fn notifying( self, notice: impl Fn(&RunningTask) -> String + Send + Sync + 'static, ) -> Self
The notice the parent is posted when the lease is dropped unconcluded.
pub fn task(&self) -> &Arc<RunningTask> ⓘ
Sourcepub fn conclude(self, status: RunningStatus, notice: Option<String>)
pub fn conclude(self, status: RunningStatus, notice: Option<String>)
End the task with status. notice is posted to the session first,
so whoever wakes on the task’s end finds it there to withdraw; a task
already stopped from outside gets none, since whoever stopped it knows.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TaskLease
impl !UnwindSafe for TaskLease
impl Forget for TaskLease
impl Freeze for TaskLease
impl Move for TaskLease
impl Send for TaskLease
impl Sync for TaskLease
impl Unpin for TaskLease
impl UnsafeUnpin for TaskLease
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