[][src]Module async_std::task

Asynchronous tasks.

This module is similar to std::thread, except it uses asynchronous tasks in place of threads.

Examples

Spawn a task and await its result:

use async_std::task;

let handle = task::spawn(async {
    1 + 2
});

Structs

AccessError

An error returned by LocalKey::try_with.

Builder

Task builder that configures the settings of a new task.

Context

The Context of an asynchronous task.

JoinHandle

A handle that awaits the result of a task.

LocalKey

The key for accessing a task-local value.

Task

A handle to a task.

TaskId

A unique identifier for a task.

Waker

A Waker is a handle for waking up a task by notifying its executor that it is ready to be run.

Enums

Poll

Indicates whether a value is available or if the current task has been scheduled to receive a wakeup instead.

Functions

block_on

Spawns a task and blocks the current thread on its result.

current

Returns a handle to the current task.

sleep

Sleeps for the specified amount of time.

spawn

Spawns a task.