Struct bevy_tasks::Task [−][src]
pub struct Task<T>(_);
Expand description
Wraps async_executor::Task
, a spawned future.
Tasks are also futures themselves and yield the output of the spawned future.
When a task is dropped, its gets canceled and won’t be polled again. To cancel a task a bit
more gracefully and wait until it stops running, use the cancel()
method.
Tasks that panic get immediately canceled. Awaiting a canceled task also causes a panic.
Wraps async_executor::Task
Implementations
Detaches the task to let it keep running in the background. See
async_executor::Task::detach
Cancels the task and waits for it to stop running.
Returns the task’s output if it was completed just before it got canceled, or None
if
it didn’t complete.
While it’s possible to simply drop the Task
to cancel it, this is a cleaner way of
canceling because it also waits for the task to stop running.
See async_executor::Task::cancel
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Task<T>
impl<T> UnwindSafe for Task<T>
Blanket Implementations
Mutably borrows from an owned value. Read more
A convenience for calling Future::poll()
on !
Unpin
types.
Returns the result of self
or other
future, preferring self
if both are ready. Read more
Returns the result of self
or other
future, with no preference if both are ready. Read more
Catches panics while polling the future. Read more
Boxes the future and changes its type to dyn Future + Send + 'a
. Read more
into_future
)The output that the future will produce on completion.
type Future = F
type Future = F
into_future
)Which kind of future are we turning this into?
into_future
)Creates a future from a value.