Skip to content
CryoCryo home
Stdlibfuture

ready

import std::future::ready; · source

Types

Ready<T>

type struct Ready<T> {
    value: Option<T>;

    static new(value: T) -> Ready<T>;
}

Ready::new(value) is a future that completes immediately — useful for testing and for satisfying a Future bound with a value you already have.

Properties

PropertyType
valueOption<T>

Constructors

static new(value: T) -> Ready<T>;

PendingThenReady<T>

type struct PendingThenReady<T> {
    remaining: u32;
    value:     Option<T>;

    static new(pending_count: u32, value: T) -> PendingThenReady<T>;
}

PendingThenReady::new(n, value) returns Pending for the first n polls, waking itself each time, then completes — the simplest way to exercise an executor's re-scheduling path in a test.

Both panic if polled again after completing.

Properties

PropertyType
remainingu32
valueOption<T>

Constructors

static new(pending_count: u32, value: T) -> PendingThenReady<T>;

Trait implementations

Ready

implement<T> trait Future<T> for struct Ready<T>

PendingThenReady

implement<T> trait Future<T> for struct PendingThenReady<T>