| Crates.io | avx-async |
| lib.rs | avx-async |
| version | 0.5.0 |
| created_at | 2025-12-17 02:31:27.880399+00 |
| updated_at | 2025-12-17 02:31:27.880399+00 |
| description | Revolutionary async runtime - Quantum, Neural Networks, Blockchain, Genetic Algorithms, Zero dependencies |
| homepage | https://github.com/arxis/avx-async |
| repository | https://github.com/arxis/avx-async |
| max_upload_size | |
| id | 1989191 |
| size | 220,125 |
Native async runtime for Rust - A lightweight, high-performance alternative to Tokio using only Rust std.
Add this to your Cargo.toml:
[dependencies]
avx-async = "0.1"
use avx_async::{Runtime, sleep};
use std::time::Duration;
fn main() {
let rt = Runtime::new();
rt.block_on(async {
println!("Hello from avx Async!");
sleep(Duration::from_secs(1)).await;
println!("One second later...");
});
}
use avx_async::Runtime;
fn main() {
let rt = Runtime::new();
rt.block_on(async {
// Spawn a task without waiting for result
rt.spawn(async {
println!("Background task running!");
});
// Spawn a task and get a handle
let handle = rt.spawn_with_handle(async {
42
});
let result = handle.await_result().await;
println!("Result: {:?}", result);
});
}
use avx_async::{Runtime, channel};
fn main() {
let rt = Runtime::new();
rt.block_on(async {
let (tx, rx) = channel::bounded::<i32>(10);
rt.spawn(async move {
for i in 0..5 {
tx.send(i).await.unwrap();
}
});
while let Some(val) = rx.recv().await {
println!("Received: {}", val);
}
});
}
use avx_async::{Runtime, timeout, sleep};
use std::time::Duration;
fn main() {
let rt = Runtime::new();
rt.block_on(async {
let result = timeout(Duration::from_secs(1), async {
sleep(Duration::from_millis(100)).await;
42
}).await;
match result {
Ok(val) => println!("Success: {}", val),
Err(_) => println!("Timeout!"),
}
});
}
use avx_async::{Runtime, net::TcpListener};
use std::net::SocketAddr;
fn main() {
let rt = Runtime::new();
rt.block_on(async {
let addr: SocketAddr = "127.0.0.1:8080".parse().unwrap();
let listener = TcpListener::bind(addr).await.unwrap();
println!("Listening on {}", addr);
loop {
let (mut stream, peer) = listener.accept().await.unwrap();
println!("Connection from {}", peer);
rt.spawn(async move {
let mut buf = vec![0u8; 1024];
if let Ok(n) = stream.read(&mut buf).await {
stream.write_all(&buf[..n]).await.ok();
}
});
}
});
}
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 taskssleep(duration) - Sleep for specified durationyield_now() - Yield execution to other taskstimeout(duration, future) - Execute future with timeoutchannel::bounded(capacity) - Create bounded channelchannel::unbounded() - Create unbounded channelsender.send(value) - Send value through channelreceiver.recv() - Receive value from channelTcpListener::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 streamRun examples with:
cargo run --example hello_world
cargo run --example channel_demo
cargo run --example timeout_demo
cargo run --example parallel_tasks
avx Async is designed for:
| Feature | avx Async | Tokio |
|---|---|---|
| Dependencies | 0 | Many |
| Size | Small | Large |
| Complexity | Simple | Complex |
| Ecosystem | Growing | Mature |
| I/O Driver | Basic | Advanced |
Contributions are welcome! Please feel free to submit a Pull Request.
Licensed under either of:
at your option.
Nícolas Ávila nicolas@avila.inc