atask 0.1.1

An async task implementation
Documentation
  • Coverage
  • 100%
    29 out of 29 items documented1 out of 23 items with examples
  • Size
  • Source code size: 53.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.35 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Spartan2909/atask
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Spartan2909

atask

atask is a flexible task model for building async executors.

First, create a queue to hold the scheduled tasks.

let (sender, reciever) = flume::unbounded();

A task is spawned using a spawn* function.

let future = async { "hewwo" };

let schedule = move |runnable| sender.send(runnable).unwrap();

let (runnable, handle) = atask::spawn(future);

runnable.schedule();

Finally, the spawned tasks must be polled.

for runnable in receiver {
    runnable.run();
}

Differences from async-task

async-task is a very similar library with a few key differences.

The primary differences are:

  • Cancelling or detaching a task does not consume the handle.
  • Tasks are detached rather than consumed on dropping the handle.

Cargo features

  • std (default): Enables the use of the standard library and enables the spawn_local messages.