now_or_never
Polls future exactly once and returns its output if it was already ready.
Useful to peek at a future that may have finished (a channel receive, a cached value) without waiting for it. The future is dropped if it was not ready, so use it on futures you can afford to abandon.
Import
Section titled “Import”Cargo feature future (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
future | F | The future to poll once. |
Returns
Section titled “Returns”Option<F::Output> — Some(output) when the first poll completed, None when it was still pending.
