Skip to main content

ringcore/
lib.rs

1//! # RingCore
2//! 
3//! A minimalist async runtime powered by Linux's `io_uring`.
4//! 
5//! RingCore provides a transparent, "from-scratch" implementation of an asynchronous
6//! runtime. It is designed for educational purposes and high-performance I/O tasks
7//! where transparency over the underlying kernel operations is preferred.
8//! 
9//! ## Key Components
10//! - `executor`: A single-threaded task scheduler and event loop.
11//! - `ring`: Low-level abstraction over the `io_uring` submission and completion queues.
12//! - `op`: Asynchronous operations (read, write, accept, etc.) that map to `io_uring` SQEs.
13//! - `net`/`fs`: High-level wrappers for networking and file system operations.
14//! 
15//! ## Example: Simple Echo Server
16//! ```no_run
17//! use ringcore::{run, spawn, TcpListener};
18//! 
19//! fn main() {
20//!     spawn(async {
21//!         let listener = TcpListener::bind("127.0.0.1:8080").unwrap();
22//!         loop {
23//!             let (stream, _) = listener.accept().await.unwrap();
24//!             spawn(async move {
25//!                 let mut buf = [0u8; 1024];
26//!                 let n = stream.read(&mut buf).await.unwrap();
27//!                 stream.write(&buf[..n]).await.unwrap();
28//!             });
29//!         }
30//!     });
31//!     run();
32//! }
33//! ```
34
35#![warn(missing_docs)]
36
37pub mod sys;
38pub mod ring;
39pub mod executor;
40pub mod op;
41pub mod net;
42pub mod fs;
43
44pub use executor::{run, spawn, init, RING};
45pub use net::{TcpListener, TcpStream};
46pub use fs::File;