Crate hyena

Source
Expand description

Hyena is a simple, fast, and safe async task pool.

§Examples

// create a new task pool
let task_pool = TaskPool::new().unwrap();

// spawn a task
let task = task_pool.spawn(async {
    // do some async work
    2 + 2
});

// wait for the task to complete
let result = task.block_on();
assert_eq!(result, 4);

Structs§

Scope
Allow spawning Tasks on the thread pool that aren’t 'static.
Task
A task that can be spawned onto a TaskPool.
TaskPool
A pool of threads for running Tasks.
TaskPoolBuilder
Builder for a TaskPool.

Functions§

block_on
Blocks the current thread until the future completes.
scope
Creates a Scope on the global TaskPool.
spawn
Spawns a Task on the global TaskPool.
spawn_local
Spawns a Task on the thread local executor.