futures-cputask
This library allows you to run long-running CPU-bound tasks on a secondary thread pool and receive a future you can await on.
Features
-
Uses Futures 0.3.0
-
For Async/Await
-
Runs tasks on a secondary threadpool to avoid blocking one of the main executor threads
-
Supports the threadpool from
threadpool
anduvth
using their respective cargo feature -
Has traits for allowing interoperability with other threadpool implementations
-
Contains an optional custom attribute
async_task
to turn a regular function into an async function using this crate(Note: currently this feature only works with the
threadpool
anduvth
threadpools)
Usage
Add this to your Cargo.toml
:
= "0.3.0"
if you want to use the custom attribute, add this:
[]
= "0.3.0"
= ["derive"]
Example
use async_task;
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.