std-type
Poll: ready result or pending work
The enum distinguishes completion from an unfinished operation. Pending is neither an error nor an empty successful result. In an asynchronous protocol, returning Pending carries a responsibility to arrange a later notification if progress becomes possible. Expected stdout (not executed): waiting done 5 Common mistake: Confusing Poll::Pending with Poll::Ready(None).
Formal Syntax & Structure
rust syntaxrust
enum Poll<T> { Ready(T), Pending }Working Example
Example Snippetrust
fn main() { use std::task::Poll; let steps = [Poll::Pending, Poll::Ready(5)]; for step in steps { match step { Poll::Pending => println!("waiting"), Poll::Ready(n) => println!("done {n}") } }}