compio-io
IO traits for completion-based async IO.
This crate provides async IO traits designed for completion-based operations. Unlike traditional poll-based async IO traits, these traits work with owned buffers and return both the buffer and the operation result upon completion.
The crate itself is runtime-agnostic and can be used with any completion-based async IO runtime.
Usage
For application
Use compio::io re-exported from compio crate, then use the io traits in your application:
use ;
For library
If you are writing libraries that want to support completion-based async IO, you can depend on this crate directly:
Then you can use the io traits in your library:
use ;
Content
Fundamental
AsyncRead: Async read into a buffer implementsIoBufMutAsyncReadAt: Async read into a buffer implementsIoBufMutwith offsetAsyncWrite: Async write from a buffer implementsIoBufAsyncWriteAt: Async write from a buffer implementsIoBufwith offset
Buffered IO
AsyncBufRead: Trait of async read with buffered contentBufReader: An async reader with internal bufferBufWriter: An async writer with internal buffer
Extension
AsyncReadExt: Extension trait forAsyncReadAsyncReadAtExt: Extension trait forAsyncReadAtAsyncWriteExt: Extension trait forAsyncWriteAsyncWriteAtExt: Extension trait forAsyncWriteAt
Adapters
framed::Framed: AdaptsAsyncReadtoStreamandAsyncWritetoSink, with framed en/decoding.compat::SyncStream: Adapts async IO to std blocking io (requirescompatfeature)compat::AsyncStream: Adapts async IO tofutures_util::iotraits (requirescompatfeature)
Utils
See docs.rs for detail: copy, null, repeat, split, split_unsync.