class Task
pub class Task<T>
The handle of a task, which spawn gives: the body's result once it ended, or the error it ended with.
Its type carries that error — Task<T> throws E — and Task.await throws it.
Methods
pub fn isDone(): bool
Returns whether the body has ended, with its value, with an error, or by a panic.
pub fn status(): TaskStatus<T>
Returns where the task stands, without waiting, and without panicking where the task did.
pub mut fn await(): T throws Error
Returns the body's value once it has ended; the running task waits until then.
Where the body panicked, the panic is raised again here, with its code, message and trace.
Errors
Throws the error the body ended with, and Cancelled in a cancelled task. What it throws
is read off the handle's type at the call; the declared Error stands for it.
pub fn cancel(): void
Cancels the task: its next wait throws Cancelled — at once, where it waits now — and so does every wait after it. A task that has ended stays as it ended.