Poll::Pending is a Rust polling result indicating that an asynchronous computation is not yet ready to produce its output.
Poll::Pending indicates that a future is not yet ready to yield its output. The executor can schedule other tasks while it waits; a Waker can later notify the executor to poll the task again. section 10.5section 10.6
Custom timer future
An AsyncTimer future returns Poll::Pending before its expiration time and starts a sleeping thread. When the timer expires, its Waker signals the executor to poll again; the future then returns Poll::Ready with a string. section 10.5
How Rust Servers, Services, and Apps covers it
How deep it goes
Defines the result and traces it through a custom timer future, a Waker, and executor rescheduling.
Examples
Uses an expiration timer and a second task to demonstrate pending work and later completion.
What you can do after
Build a custom timer future that returns pending until expiration and wakes its executor task.
How it connects
Links pending results to Future, Poll::Ready, Waker, and the async executor.
promisepart of · A JavaScript Promise is an object representing the eventual completion or failure of an asynchronous operation and its resulting value or reason.
readycontrasts with · Poll::Ready is a Rust asynchronous computation result containing the computation's completed output.
spinnerproduces · A spinner is an animated user-interface indicator that signals an ongoing, pending, or waiting operation without specifying its completion state.
pending setused by · A pending set is the set returned by asyncio.wait containing awaitables that have not completed when the wait returns.
This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.