Skip to main content

compio/
lib.rs

1//! # Compio
2//! A thread-per-core Rust runtime with IOCP/io_uring/polling.
3//! The name comes from "completion-based IO".
4//! This crate is inspired by [monoio](https://github.com/bytedance/monoio/).
5//!
6//! ## Quick start
7//! ```rust
8//! # compio::runtime::Runtime::new().unwrap().block_on(async {
9//! use compio::{fs::File, io::AsyncReadAtExt};
10//!
11//! let file = File::open("Cargo.toml").await.unwrap();
12//! let (read, buffer) = file
13//!     .read_to_end_at(Vec::with_capacity(1024), 0)
14//!     .await
15//!     .unwrap();
16//! assert_eq!(read, buffer.len());
17//! let buffer = String::from_utf8(buffer).unwrap();
18//! println!("{}", buffer);
19//! # })
20//! ```
21//!
22//! ## Observability
23//! The `console` feature instruments the runtime for [`tokio-console`], which
24//! [`console_subscriber`] then reports to.
25//!
26//! See [`runtime::console`] for the setup it takes, and for what is reported
27//! and what is not.
28//!
29//! [`tokio-console`]: https://github.com/tokio-rs/console
30//! [`console_subscriber`]: https://docs.rs/console-subscriber
31// The module is only there with the `runtime` feature, so the link is spelled
32// out rather than resolved, like the two above.
33//! [`runtime::console`]: https://docs.rs/compio-runtime/latest/compio_runtime/console/
34
35#![cfg_attr(docsrs, feature(doc_cfg))]
36#![allow(unused_features)]
37#![warn(missing_docs)]
38#![deny(rustdoc::broken_intra_doc_links)]
39#![doc(
40    html_logo_url = "https://github.com/compio-rs/compio-logo/raw/refs/heads/master/generated/colored-bold.svg"
41)]
42#![doc(
43    html_favicon_url = "https://github.com/compio-rs/compio-logo/raw/refs/heads/master/generated/colored-bold.svg"
44)]
45
46#[doc(no_inline)]
47pub use buf::BufResult;
48#[cfg(feature = "arrayvec")]
49pub use buf::arrayvec;
50#[cfg(feature = "bumpalo")]
51pub use buf::bumpalo;
52#[cfg(feature = "bytes")]
53pub use buf::bytes;
54#[cfg(feature = "smallvec")]
55pub use buf::smallvec;
56#[cfg(feature = "actor")]
57#[doc(inline)]
58pub use compio_actor as actor;
59#[cfg(feature = "compat")]
60pub use compio_compat as compat;
61#[cfg(feature = "dispatcher")]
62#[doc(inline)]
63pub use compio_dispatcher as dispatcher;
64#[cfg(feature = "fs")]
65#[doc(inline)]
66pub use compio_fs as fs;
67#[cfg(feature = "io")]
68#[doc(inline)]
69pub use compio_io as io;
70#[cfg(feature = "macros")]
71pub use compio_macros::*;
72#[cfg(feature = "net")]
73#[doc(inline)]
74pub use compio_net as net;
75#[cfg(feature = "process")]
76#[doc(inline)]
77pub use compio_process as process;
78#[cfg(feature = "quic")]
79#[doc(inline)]
80pub use compio_quic as quic;
81#[cfg(feature = "runtime")]
82#[doc(inline)]
83pub use compio_runtime as runtime;
84#[cfg(feature = "signal")]
85#[doc(inline)]
86pub use compio_signal as signal;
87#[cfg(feature = "term")]
88#[doc(inline)]
89pub use compio_term as term;
90#[cfg(feature = "tls")]
91#[doc(inline)]
92pub use compio_tls as tls;
93#[cfg(feature = "ws")]
94#[doc(inline)]
95pub use compio_ws as ws;
96#[cfg(feature = "time")]
97#[doc(inline)]
98pub use runtime::time;
99#[cfg(feature = "native-tls")]
100pub use tls::native_tls;
101#[cfg(feature = "rustls")]
102pub use tls::rustls;
103#[doc(inline)]
104pub use {compio_buf as buf, compio_driver as driver};