The article discusses a limitation in Rust's Future trait: calling poll() after a future returns Poll::Ready is undefined behavior, often causing panics. It highlights the usefulness of being able to reuse completed futures and introduces MaybeDone as a wrapper that provides a third 'done' state to safely handle this scenario.
Background
Rust's async ecosystem relies on the Future trait, which only defines two completion states (Pending and Ready). This design choice can lead to runtime panics when code inadvertently polls a completed future multiple times.
- Source
- Lobsters
- Published
- Oct 29, 2026 at 12:24 PM
- Score
- 6.0 / 10