Function poll_immediate
fn poll_immediate<F: Future>(f: F) -> PollImmediate<F>
Creates a future that is immediately ready with an Option of a value. Specifically this means that poll always returns Poll::Ready.
Caution
When consuming the future by this function, note the following:
- This function does not guarantee that the future will run to completion, so it is generally incompatible with passing the non-cancellation-safe future by value.
- Even if the future is cancellation-safe, creating and dropping new futures frequently may lead to performance problems.
Examples
# block_on;
Reusing a future
# block_on;