docs

你正在阅读 v0.1.2 的文档。Nabi 0.1.2 已不再提供支持。 最新版本:v0.1.3 →

core::future

本页内容

API 参考只有英文版,由标准库源代码中的英文文档注释生成。

Future / Poll / Context / Waker / IntoFuture.

await e (inside an async body) polls e - or e.into_future() when e has no poll - until Ready, suspending the coroutine with Pending in between (nabic_typeck::lower::coro).

Structs

WakerSource

pub struct Waker

Asks the executor to poll a task again: a handle to the task (core::task), usable from any thread.

  • pub fn wake(self)§

    Source

    Schedule the task again.

Trait implementations 2

ContextSource

pub struct Context

What a poll gets from the executor.

  • pub const fn from_waker(waker: Waker) -> Context§

    Source

    A context that wakes through waker.

  • pub const fn waker(self) -> Waker§

    Source

    The waker of the task being polled.

Trait implementations 1

AsyncFutureSource

pub struct AsyncFuture<T>
Trait implementations 4
  • impl<T> Debug for AsyncFuture<T>
  • unsafe impl<T: Send> Send for AsyncFuture<T>
  • impl<T> Future for AsyncFuture<T>
  • impl<T> Transfer for AsyncFuture<T>

TryAsyncFutureSource

pub struct TryAsyncFuture<T, E>

A throwing async body (async fn f() throws (E) -> T): the error comes out of poll, so try await f(). Not a Future (whose poll cannot throw); await and task::try_block_on take it.

  • pub const fn poll(ref self, ref ctx: Context) throws (E) -> Poll<T>§

    Source

    Resume the body: Ready with its value, or Pending; throws what the body throws.

Trait implementations 3
  • unsafe impl<T: Send, E: Send> Send for TryAsyncFuture<T, E>
  • impl<T, E> Debug for TryAsyncFuture<T, E>
  • impl<T, E> Transfer for TryAsyncFuture<T, E>

Enums

PollSource

pub enum Poll<T>

The state of a future after one poll: Ready with its output, or Pending until its waker fires.

Traits

FutureSource

pub trait Future

An asynchronous computation.

IntoFutureSource

pub trait IntoFuture

What await accepts besides a Future.