[][src]Crate blocker

Codecov Docs.rs Crates.io


Blocker blocks. That's what it does, nothing more. Give it an async function and it waits until it's done. Forever. Works in #![no_std] environments as long as alloc is available. Blocker itself does not use any unsafe code.

Enable the thread_yield feature to yield the current thread whenever an async function returns Poll::pending.


This code is licensed under the Apache 2.0 license





block is the heart of the blocker crate. When called with any future as parameter it blocks the program until the future completes. When futures return Pending, the future will just be repolled. When the thread_yield feature is enabled, a pending future will yield the current thread. Note that this only works when std is available.