spin_future

Crates.iospin_future
lib.rsspin_future
version0.1.0
sourcesrc
created_at2020-10-02 00:00:20.954708
updated_at2020-10-02 00:00:20.954708
descriptionConvert synchronous functions into valid but inefficient futures
homepage
repository
max_upload_size
id295212
size4,995
Paul Kernfeld (paulkernfeld)

documentation

README

spin_future

Convert synchronous functions into valid but inefficient futures.

This crate needs rust 1.46 or newer to get around an interesting issue.

The key trick to make this valid is that we always call the waker if we are going to return Pending. That way the executor is guaranteed to continue polling us. I got this trick from user HadrienG in this Rust forum post.

Commit count: 0

cargo fmt