lio 0.4.0

A platform-independent async I/O library with native support for io_uring (Linux), IOCP (Windows), and kqueue (macOS)
docs.rs failed to build lio-0.4.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: lio-0.4.1

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, and can integrate with 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. 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> 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();