Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
futures-util: Added FutureExt::now_or_never()
`now_or_never()` is a convenience method for `FutureExt` that evaluates and consumes the future, returning the resulting output if the future is ready after the first call to `Future::poll`. If `poll` instead returns `Poll::Pending`, `None` is returned. This method is useful in cases where immediacy is more important than waiting for a result. It is also convenient for quickly obtaining the value of a future that is known to always resolve immediately. It is named after the english phrase "It's *now or never*", which the Macmillan Dictionary defines[¹] as such: > used for saying that if something is not done immediately, there > will not be another chance to do it in the future [¹]: https://www.macmillandictionary.com/us/dictionary/american/it-s-now-or-never
- Loading branch information