[][src]Crate 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.

Functions

until_some

Convert a function that returns Option<T> into a valid but inefficient future. The future will resolve only when the function returns Some.

until_true

Convert a function that returns bool into a valid but inefficient future. The future will resolve only when the function returns true.