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
//! # Lio - Low-Level Async I/O Library
//!
//! Lio is a non-blocking, platform-independent, zero-copy (when possible)
//! I/O library that provides control back to the user. It does so by giving
//! raw access to the syscall arguments, which it then builds upon. For
//! example Lio (optionally) can [manage buffers in a zero-copy way](crate::buf),
//! and [can integrate with zeroize](crate::buf#`zeroize`).
//!
//! It uses the most efficient I/O available based on OS. It uses:
//! - **Linux**: io_uring, epoll as backup.
//! - **BSD/Apple**: kqueue.
//! - **Windows**: I/O Completion Ports.
//!
//! As lio is platform-independent, it needs to abstract over OS resources like
//! files/sockets. `lio` calls these [resources](crate::api::resource).
//! Resources are reference counted OS-native identifiers (fd's/handles/etc),
//! which means that cloning is cheap. `lio` will automatically drop/close these
//! on the last reference's drop.
//!
//! ### Example
//! All operations return a [`Io<T>`](crate::api::io::Io) which represents an in-flight I/O operation:
//!
//! ```
//! use lio::{Lio, api};
//!
//! let mut lio = Lio::new(64).unwrap();
//! let resource = api::resource::Resource::stdout();
//! let data = b"Hello\n".to_vec();
//!
//! // Callback-based
//! api::write(&resource, data).with_lio(&mut lio).when_done(|(result, buf)| {
//! // result: io::Result<i32>, buf: the original Vec
//! });
//! lio.try_run().unwrap();
//! ```
pub use BufResult;
// Re-export core types
pub use ;