Minimal non-blocking I/O for Rust.
See examples/
folder for usage.
Async I/O in Rust is still an unsolved problem. With the stabilization ofasync/await, we are seeing a number of libraries and runtimes crop up, suchas async-std and smol, while others such as tokio and mio are maturing.The problem with async/await is that you can't use any of the standardlibrary traits, such as Read
and Write
. The async ecosystem comes with anentirely separate suite of traits (eg. AsyncRead
and AsyncWrite
) and I/Olibraries. Furthermore, most of these runtimes have a large dependencyfootprint, partly from having to provide async alternatives to the standardlibrary functions, and partly due to the complexity of these runtimes.
What do we need? For most use-cases, the ability to handle between a dozenand up to a few hundred open connections without blocking, is all we need.This places us squarely within the territory of the venerable poll()
function,which is available on almost all platforms.
Popol is designed as a minimal ergonomic wrapper around poll()
, built forpeer-to-peer networking.
By building on poll
, we have the following advantages:
io::Read
, io::Write
, etc.)Why not use epoll
? A couple of reasons:
poll
and requires us to write more codepoll
is sufficient for handling most workloadsCompared to mio, popol is:
Some of the advantages of popol's API over mio's:
u64
.On the other hand, mio is more mature and probably better at handling verylarge number of connections. Mio also currently supports more platforms.
This software is licensed under the MIT license. See the LICENSE
file fordetails.
(c) Alexis Sellier https://cloudhead.io
文章类 Rust 模块系统的超清晰解释 Rust 的模块系统可能对于新人来说有些困惑,这篇文章通过几个循序渐进的小例子,让你快速且清晰的对 Rust 模块系统有一个基本的认识. http://www.sheshbabu.com/posts/rust-module-system/ 使用 Rust 实现 boids 算法 (Game) 这是 Rust 来实现经典的 Boids 算法的一系列文章的 Pa