#mio #event-loop #stakker #file-io #unix-file #file-descriptor

stakker_mio

Mio I/O polling integration for the Stakker crate

12 releases

0.2.5 Mar 14, 2023
0.2.4 Sep 6, 2022
0.2.3 Nov 1, 2021
0.2.2 May 14, 2021
0.0.2 Mar 4, 2020

#305 in Asynchronous

Download history 4/week @ 2024-02-15 25/week @ 2024-02-22 18/week @ 2024-02-29 87/week @ 2024-03-07 95/week @ 2024-03-14

226 downloads per month
Used in stakker_tui

MIT/Apache

71KB
1K SLoC

Rust 1K SLoC // 0.0% comments Perl 139 SLoC // 0.2% comments

Mio I/O polling integration for the Stakker crate

This integrates the mio crate with Stakker and makes handling mio sources more convenient.

Documentation

See the crate documentation.

License

This project is licensed under either the Apache License version 2 or the MIT license, at your option. (See LICENSE-APACHE and LICENSE-MIT).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Integrates mio into Stakker.

MioPoll is the main type. It handles polling and converting mio events into Stakker forward calls. It offers priority levels to allow some events to take priority over others. In addition token cleanup is handled through drop handlers.

TcpStreamBuf makes it easier to do buffering for a mio::net::TcpStream.

FdSource wraps an arbitrary UNIX file descriptor for use with MioPoll.

All calls retry on ErrorKind::Interrupted internally, so this error doesn't have to be handled by the caller. Retrying is the most helpful behaviour in a non-blocking event loop. In an app using blocking I/O you might want a blocked call to be cut short on a signal, but that case doesn't apply here.

The mio version used by this library is re-exported as stakker_mio::mio. This should be used by applications in place of importing mio directly, to guarantee they're using the same version.

Dependencies

~1–12MB
~123K SLoC