#mio #event-loop #stakker

stakker_mio

Mio I/O polling integration for the Stakker crate

7 releases

0.2.0 Nov 8, 2020
0.1.3 Jul 14, 2020
0.1.2 Jun 26, 2020
0.1.0 Apr 4, 2020
0.0.1 Jan 23, 2020

#216 in Asynchronous

Download history 22/week @ 2020-10-28 47/week @ 2020-11-04 49/week @ 2020-11-11 27/week @ 2020-11-18 36/week @ 2020-11-25 39/week @ 2020-12-02 34/week @ 2020-12-09 25/week @ 2020-12-16 23/week @ 2020-12-23 28/week @ 2020-12-30 29/week @ 2021-01-06 34/week @ 2021-01-13 29/week @ 2021-01-20 27/week @ 2021-01-27 25/week @ 2021-02-03 49/week @ 2021-02-10

80 downloads per month
Used in stakker_tui

MIT/Apache

30KB
546 lines

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

~1MB
~21K SLoC