25 releases (14 stable)

5.0.5 Feb 8, 2023
5.0.3 Nov 2, 2022
5.0.2 Mar 4, 2022
5.0.1 Aug 8, 2021
0.1.0 Dec 11, 2016

#45 in Asynchronous

Download history 11011/week @ 2024-01-10 11283/week @ 2024-01-17 10968/week @ 2024-01-24 10712/week @ 2024-01-31 10578/week @ 2024-02-07 9490/week @ 2024-02-14 10767/week @ 2024-02-21 9955/week @ 2024-02-28 10213/week @ 2024-03-06 10834/week @ 2024-03-13 9668/week @ 2024-03-20 10049/week @ 2024-03-27 13541/week @ 2024-04-03 15542/week @ 2024-04-10 14381/week @ 2024-04-17 11573/week @ 2024-04-24

57,165 downloads per month
Used in 75 crates (7 directly)

MIT license

528 lines

Crates.io MIT licensed Build Status

mio-serial: A serial port IO library MIO.

mio-serial provides a serial port implementation using mio.


Add mio-serial to you Cargo.toml:

mio-serial = "5.0.1"

Then add this to your crate root:

extern crate mio_serial;


The "libudev" dependency of serialport-rs is enabled by default. For x86 linux systems this enables the available_ports function for port enumeration. Not all targets support udev, especially when cross-compiling. To disable this feature, compile with the --no-default-features option. For example:

cargo build --no-default-features


The Minimum Supported Rust Version is 1.60.0 as found using cargo-msrv


A few examples can be found here.


Useful tests for serial ports require... serial ports, and serial ports are not often provided by online CI providers. As so, automated build testing are really only check whether the code compiles, not whether it works.

Integration tests are in the tests/ directory and typically require two serial ports to run. The names of the serial ports can be configured at run time by setting the TEST_PORT_NAMES environment variable to a semi-colon delimited string with the two serial port names. The default values are:

  • For Unix: TEST_PORT_NAMES=/dev/ttyUSB0;/dev/ttyUSB1
  • For Windows: TEST_PORT_NAMES=COM1;COM2

IMPORTANT To prevent multiple tests from talking to the same ports at the same time make sure to limit the number of test threads to 1 using:

cargo test -j1 -- --test-threads=1


This software is licensed under MIT.

This software builds upon the MPL-2.0 licensed serialport-rs and constitutes a "Larger Work" by that license. The source for serialport-rs can be found at https://gitlab.com/susurrus/serialport-rs.


~113K SLoC