|0.3.21||Feb 6, 2022|
|0.3.19||Dec 18, 2021|
|0.3.16||Jul 23, 2021|
|0.2.0-beta||Mar 20, 2018|
#59 in Asynchronous
2,104,177 downloads per month
Used in 1,891 crates (122 directly)
Executors for asynchronous tasks based on the futures-rs library.
Add this to your
[dependencies] futures-executor = "0.3"
futures-executor requires Rust 1.45 or later.
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.
Built-in executors and related tools.
All asynchronous computation occurs within an executor, which is capable of spawning futures as tasks. This module provides several built-in executors, as well as tools for building your own.
All items are only available when the
std feature of this
library is activated, and it is activated by default.
Most of the time tasks should be executed on a thread pool.
A small set of worker threads can handle a very large set of spawned tasks
(which are much lighter weight than threads). Tasks spawned onto the pool
spawn_ok function will run ambiently on
the created threads.
In addition to thread pools, it's possible to run a task (and the tasks
it spawns) entirely within a single thread via the [
Aside from cutting down on synchronization costs, this executor also makes
it possible to spawn non-
Send tasks, via
LocalPool] is best suited for running I/O-bound tasks that do relatively
little work between I/O operations.
There is also a convenience function [
block_on] for simply running a
future to completion on the current thread.