Future trait
The trait for a value that will be ready later; async functions return one.
A Future is polled by an executor until it returns Poll::Ready; it does nothing on its own, so creating one without awaiting or spawning it runs none of its code.
Loading interactive…
Examples
Calling
read_station("harbor");without.awaitruns none of its body; rustc warnsunused implementer ofFuturethat must be used.Futurehas one method,poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>, which returnsPoll::Ready(value)orPoll::Pending.