Repository navigation
Expand file tree
/
Copy pathlib.rs
More file actions
99 lines (95 loc) · 3.59 KB
/
Copy pathlib.rs
File metadata and controls
99 lines (95 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(unsafe_op_in_unsafe_fn)]
// Local safety contracts are required across supported platforms. This lint
// does not replace the lifecycle audits tracked in docs/vibeio-cleanup.md.
#![warn(clippy::undocumented_unsafe_blocks)]
//! # vibeio
//!
//! A high-performance, cross-platform asynchronous runtime for Rust.
//!
//! `vibeio` provides an efficient I/O event loop that leverages the best
//! available driver for each operating system:
//!
//! - **Linux** - uses `io_uring` for true asynchronous I/O.
//! - **Windows** - uses I/O Completion Ports (IOCP) for scalable I/O.
//! - **macOS / BSD / Others** - uses `kqueue` or `epoll` via `mio` for event
//! notification.
//!
//! ## Core features
//!
//! - **Networking** - asynchronous TCP, UDP, and Unix Domain Sockets.
//! - **File system** - asynchronous file operations.
//! - **Timers** - efficient timer and sleep functionality.
//! - **Signals** - handling of OS signals.
//! - **Process management** - spawning and managing child processes.
//! - **Blocking tasks** - offload CPU-intensive or blocking operations to a
//! thread pool.
//!
//! ## Concurrency model: thread-per-core
//!
//! `vibeio` is designed as a **single-threaded** runtime. To utilize multiple
//! cores, you should employ a **thread-per-core** architecture, where a
//! separate `Runtime` is pinned to each processor core. This approach minimizes
//! synchronization overhead and maximizes cache locality.
//!
//! Shared state can be communicated between runtimes using message passing
//! (e.g., channels) or shared atomic structures, but I/O resources are
//! typically owned by the thread that created them.
//!
//! ## Getting started
//!
//! This is rsloop's embedded runtime, accessed internally as `crate::vibeio`.
//! It is not a separately published package or part of rsloop's public Rust
//! API. Build and test it from the repository root; installing the upstream
//! crate does not provide this implementation. See `docs/development.md` for
//! commands.
//!
//! ## Feature flags
//!
//! Networking and timers are always compiled. The following Cargo features are
//! opt-in and disabled in default rsloop wheels. `--all-features` compiles all
//! applicable platform modules; enabling a feature does not select a driver or
//! install signal handlers until the corresponding API is used.
//!
//! - `fs` - enables asynchronous file system operations.
//! - `signal` - enables signal handling.
//! - `process` - enables child process management.
//! - `pipe` - enables pipe support.
//! - `stdio` - enables standard I/O support.
//! - `splice` - enables splice support (Linux).
//! - `scheduler-batch-cache` - opts into scheduler batch allocation reuse;
//! benchmark your workload, since TCP workloads can regress.
//! - `blocking-default` - enables the default blocking thread pool.
mod batch_allocator;
pub mod blocking;
mod builder;
mod driver;
mod executor;
mod fd_inner;
#[cfg(feature = "fs")]
pub mod fs;
pub mod io;
pub mod net;
mod op;
#[cfg(feature = "process")]
pub mod process;
#[cfg(feature = "signal")]
pub mod signal;
mod task;
#[cfg(test)]
mod test_support;
pub mod time;
mod timer;
pub mod util;
// Embedding-only readiness plumbing; standalone runtime checks do not use it.
#[allow(unused_imports)]
pub(crate) use fd_inner::InnerRawHandle;
#[cfg(windows)]
#[allow(unused_imports)]
pub(crate) use fd_inner::RawOsHandle;
#[allow(unused_imports)]
pub(crate) use op::ReadinessOp;
// Public runtime API; not every embedding uses this re-export.
#[allow(unused_imports)]
pub use crate::vibeio::driver::RegistrationMode;
pub use crate::vibeio::{builder::*, executor::*};