# ATO: A Simple Task Async Runtime for `no_std` and `no_alloc` Environments
[](https://crates.io/crates/ato) [](https://docs.rs/ato) [](#)
**ATO** is a minimal asynchronous task runtime designed for `no_std` and `no_alloc` 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 `Future`s to completion.
## Features
* **`no_std` Compatible:** Works in environments without the standard library.
* **No Allocator Needed:** Designed to operate without dynamic memory allocation.
* **Channels**: Provides basic mpmc async channels for inter-task communication.
* **Round-Robin Scheduling:** Tasks are polled sequentially until completion.
* **Simple Sleep Functionality:** Includes an async `sleep` function that requires a user-provided time source.
* **Fixed-Size Task Queue:** Uses `heapless::Q*` for a statically-sized task queue, configurable at compile time.
* **Simple Yield Functionality:** Allows yielding control back to the scheduler, enabling cooperative multitasking.
## 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`:
```toml
[dependencies]
ato = "2.0.2" # Replace with the desired version
```
## Basic Usage
Here's a basic example of how to use ATO:
```rust
const SPAWNER_SIZE: usize = 4; // Must be a power of two, e.g., 2, 4, 8, 16, etc.
fn main() {
// create a spawner with the specified size
let spawner: ato::Spawner<SPAWNER_SIZE> = ato::Spawner::default();
// create a simple task that prints a message
ato::spawn_task!(spawner, res, {
println!("Hello, World!");
});
res.unwrap();
// run until all tasks are done running
spawner.run_until_all_done().unwrap();
}
```