avx Async
Native async runtime for Rust - A lightweight, high-performance alternative to Tokio using only Rust std.
Features
- 🚀 Zero external dependencies - Pure Rust std implementation
- ⚡ Work-stealing scheduler - Efficient multi-threaded task execution
- 🔄 Async I/O primitives - Non-blocking TCP networking
- 📬 Channel support - Message passing between tasks
- ⏱️ Timeout support - Execute futures with time limits
- 🛑 Graceful shutdown - Proper cleanup and task completion
- 🎯 JoinHandle - Await task results
- 🔧 Simple API - Easy to use and understand
Installation
Add this to your Cargo.toml:
[]
= "0.1"
Quick Start
Basic Example
use ;
use Duration;
Spawning Tasks
use Runtime;
Using Channels
use ;
Timeout Operations
use ;
use Duration;
TCP Server
use ;
use SocketAddr;
API Overview
Runtime
Runtime::new()- Create a new runtime instanceruntime.block_on(future)- Block current thread and execute futureruntime.spawn(future)- Spawn a fire-and-forget taskruntime.spawn_with_handle(future)- Spawn task and return JoinHandleruntime.shutdown()- Initiate graceful shutdownruntime.task_count()- Get number of active tasks
Async Functions
sleep(duration)- Sleep for specified durationyield_now()- Yield execution to other taskstimeout(duration, future)- Execute future with timeout
Channels
channel::bounded(capacity)- Create bounded channelchannel::unbounded()- Create unbounded channelsender.send(value)- Send value through channelreceiver.recv()- Receive value from channel
Network
TcpListener::bind(addr)- Bind TCP listenerlistener.accept()- Accept incoming connectionTcpStream::connect(addr)- Connect to remote addressstream.read(buf)- Read data from streamstream.write(buf)- Write data to streamstream.write_all(buf)- Write all data to stream
Examples
Run examples with:
Performance
avx Async is designed for:
- Low latency task scheduling
- Efficient CPU utilization with work-stealing
- Minimal memory overhead
- Zero-cost abstractions
Comparison with Tokio
| Feature | avx Async | Tokio |
|---|---|---|
| Dependencies | 0 | Many |
| Size | Small | Large |
| Complexity | Simple | Complex |
| Ecosystem | Growing | Mature |
| I/O Driver | Basic | Advanced |
Limitations
- Basic I/O implementation (no io_uring, epoll, etc.)
- Limited ecosystem compared to Tokio
- No timer wheel optimization
- Designed for learning and simple use cases
Roadmap
- epoll/kqueue/IOCP support
- Timer wheel for efficient timeouts
- async-std compatibility layer
- More I/O primitives (UDP, Unix sockets)
- Tracing and metrics
- Rate limiting
- Task priorities
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Author
Nícolas Ávila nicolas@avila.inc