rokdocs
v0.1

rok::core::future

rok::core::future - Future / Poll / Context / Waker / IntoFuture (stdlib spec 2.20).

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 (refs-lang 4.12, rokc_hir::lower::coro).

Modules

    Structs

    Waker

    pub struct Waker

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

    • pub fn wake(self)

      Schedule the task again.

    • pub const fn clone(self) -> Waker

    Context

    pub struct Context

    What a poll gets from the executor (2.20.2).

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

    AsyncFuture

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

    TryAsyncFuture

    pub struct TryAsyncFuture<T

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

    Enums

    Poll

    pub enum Poll<T>
    • Ready(T)
    • Pending
    • pub const fn is_ready(self) -> bool
    • pub const fn is_pending(self) -> bool

    Traits

    Future

    pub trait Future

    An asynchronous computation (2.20.1).

    • type Output
    • fn poll(ref self, ref ctx: Context) -> Poll<Output>

    IntoFuture

    pub trait IntoFuture

    What await accepts besides a Future (2.20.5).

    • type Output
    • type IntoFuture: Future<Output = Output>
    • fn into_future(self) -> IntoFuture