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
//! A minimal, cross-platform event poller for Linux and macOS.
//!
//! **pollio** wraps native readiness APIs — [epoll](https://man7.org/linux/man-pages/man7/epoll.7.html)
//! on Linux and [kqueue](https://www.freebsd.org/cgi/man.cgi?query=kqueue) on macOS — behind a small,
//! uniform [`Poller`] trait.
//!
//! Use it as a building block for event-driven servers, custom async runtimes, or anywhere you want
//! direct control over the OS poller without pulling in a full I/O framework.
//!
//! # Supported platforms
//!
//! | Platform | Backend | Type alias |
//! |----------|---------|------------|
//! | Linux | `epoll` | [`OsPoller`] |
//! | macOS | `kqueue`| [`OsPoller`] |
//!
//! Other targets are not supported. [`OsPoller`] is exported only on Linux and macOS.
//!
//! # Quick start
//!
//! ```no_run
//! use pollio::{EventObject, OsPoller, Poller};
//!
//! fn main() -> std::io::Result<()> {
//! let mut poller = OsPoller::new()?;
//!
//! // Register a listening socket as a "server" FD.
//! let listen_fd = 0; // replace with your listening socket
//! poller.add(EventObject::server(listen_fd))?;
//!
//! loop {
//! // Block until at least one FD is readable (-1 = no timeout).
//! let ready = poller.wait(-1)?;
//!
//! for event in ready {
//! match event.kind {
//! pollio::EventKind::Server => { /* accept new connections */ }
//! pollio::EventKind::Client => { /* read from client */ }
//! }
//! }
//! }
//! }
//! ```
//!
//! # Design notes
//!
//! - **Read-only today** — registrations use `EPOLLIN` (Linux) and `EVFILT_READ` (macOS). Write
//! readiness and edge-triggered modes are not exposed yet.
//! - **FD ownership** — pollio does not close registered FDs; you manage their lifecycle.
//! - **Thread safety** — [`OsPoller`] is not [`Sync`]; typical use is a single thread driving the
//! event loop.
//! - **Error handling** — syscalls surface as [`std::io::Error`] via `last_os_error()`.
pub use ;
pub use Poller;
pub use OsPoller;
pub use OsPoller;