absurd-future 0.2.0

A future adapter that turns a future that never resolves (returns Infallible) into a future that can resolve to any type.
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented1 out of 4 items with examples
  • Size
  • Source code size: 11.98 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.42 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • fpco/absurd-future
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • psibi snoyberg

absurd-future

crates.io docs.rs

A future adapter that turns a future that never resolves (i.e., returns Infallible) into a future that can resolve to any type.

This is useful in scenarios where you have a task that runs forever (like a background service) but need to integrate it into an API that expects a specific return type, such as tokio::task::JoinSet.

For a detailed explanation of the motivation behind this crate and the concept of uninhabited types in Rust async code, see the blog post: How to use Rust's never type (!) to write cleaner async code.

Usage

For a complete, runnable example of how to use this crate with tokio::task::JoinSet, please see the example file: examples/tokio.rs.

License

This project is licensed under the MIT license.