Minimal and reusable non-blocking I/O layer
This project is developed and maintained by the HAL team.
The ultimate goal of this crate is code reuse. With this crate you can
write core I/O APIs that can then be adapted to operate in either blocking
or non-blocking manner. Furthermore those APIs are not tied to a particular
asynchronous model and can be adapted to work with the futures
model or
with the async
/ await
model.
The WouldBlock
error variant signals that the operation
can't be completed right now and would need to block to complete.
WouldBlock
is a special error in the sense that it's not
fatal; the operation can still be completed by retrying again later.
nb::Result
is based on the API of
std::io::Result
,
which has a WouldBlock
variant in its
ErrorKind
.
We can map WouldBlock
to different blocking and
non-blocking models:
- In blocking mode,
WouldBlock
means try again right now, i.e. busy waiting. - In
async
mode,WouldBlock
meansPoll::Pending
.
This crate is guaranteed to compile on stable Rust 1.62 and up. It might compile with older versions but that may change in any new patch release.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, the HAL team, promises to intervene to uphold that code of conduct.