ATO: A Simple Task Async Runtime for no_std Environments
ATO is a minimal asynchronous task runtime designed for no_std environments, making it suitable for embedded systems, operating system kernels, or other resource-constrained applications where the standard library is unavailable.
It provides a basic task spawner and a round-robin scheduler to run Futures to completion.
Features
no_stdCompatible: Works in environments without the standard library (requiresalloc).- Task Spawner: Queue multiple asynchronous tasks.
- Round-Robin Scheduling: Tasks are polled sequentially until completion.
- Simple Sleep Functionality: Includes an async
sleepfunction that requires a user-provided time source. - Fixed-Size Task Queue: Uses
heapless::Dequefor a statically-sized task queue, configurable at compile time.
Motivation
In many no_std contexts, a full-fledged async runtime like Tokio or async-std is too heavy or relies on operating system features that aren't available. ATO aims to provide the bare essentials for cooperative multitasking with futures in such environments.
Installation
Add ATO to your Cargo.toml:
[]
= "1.0.2" # Replace with the desired version
Ensure you have an allocator set up if you're in a no_std environment, as ATO uses Box for tasks.
Usage
Here's a basic example of how to use ATO:
extern crate alloc;
use ;
use Duration;
// --- You need to provide a time source function ---
// This function must return the current monotonic time as a Duration.
// The exact implementation will depend on your hardware/platform.
// For example, it might read a hardware timer.