serialport-rs
is a general-purpose cross-platform serial port library for Rust. It provides a
simple blocking I/O interface and port enumeration on POSIX and Windows systems.
For async I/O functionality, see the mio-serial and tokio-serial crates.
The library has been organized such that there is a high-level SerialPort
trait that provides
a cross-platform API for accessing serial ports. This is the preferred method of interacting
with ports and as such is part of the prelude
. The open*()
and available_ports()
functions
in the root are also cross-platform.
For platform-specific functionality, this crate is split into a posix
and windows
API with
corresponding TTYPort
and COMPort
structs, both of which implement the SerialPort
trait. Using
the platform-specific open*()
functions will return the platform-specific port object which
allows access to platform-specific functionality.
This library started as a fork of the serial-rs
library because serial-rs
was slow to include enumeration support. Additionally I found its API a
bit cumbersome as I was more familiar with QSerialPort
's API.
Rust versions 1.13 and higher are supported.
Operating system support is as follows:
Tier 1:
Tier 2:
Tier 1 supports means this library is build- and run-tested and is regularly used so this should be pretty bug-free. Tier 2 means it's only build- and run-tested, but no developer uses this as their primary development environment.
Licensed under the Mozilla Public License, version 2.0.
Please open an issue or merge request on GitLab to contibute. Code contributions submitted for inclusion in the work by you, as defined in the MPL2.0 license, shall be licensed as the above without any additional terms or conditions.
Special thanks to dcuddeback, willem66745, and apoloval who wrote the original serial-rs library which this library heavily borrows from.
Additionally I'd like to acknowledge the following people who have made contributions: