#rs232 #serial #tokio

tokio-serial

A serial port implementation for tokio

19 releases (9 stable)

5.4.1 Aug 8, 2021
5.4.0-beta4 Jul 23, 2021
4.3.3 Nov 26, 2019
3.3.0 Aug 23, 2019
0.1.0 Feb 2, 2017

#15 in Asynchronous

Download history 4192/week @ 2021-10-01 3901/week @ 2021-10-08 4460/week @ 2021-10-15 4690/week @ 2021-10-22 2737/week @ 2021-10-29 2583/week @ 2021-11-05 2404/week @ 2021-11-12 2802/week @ 2021-11-19 3393/week @ 2021-11-26 3154/week @ 2021-12-03 3026/week @ 2021-12-10 3167/week @ 2021-12-17 1374/week @ 2021-12-24 2528/week @ 2021-12-31 2788/week @ 2022-01-07 2650/week @ 2022-01-14

9,644 downloads per month
Used in 18 crates (16 directly)

MIT license

235KB
478 lines

Crates.io MIT licensed Build Status

tokio-serial

An implementation of serialport I/O for Tokio, an async framework for rust.

NOTICE

This crate is no longer actively maintained (see #40) and is open for adoption. Create an issue if interested.

MSRV

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

Usage

Add tokio-serial to you Cargo.toml:

[dependencies]
tokio-serial = "5.4.1"

Tests

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

Resources

tokio.rs serialport-rs

Dependencies

~3–4MB
~68K SLoC

a