serial_io/lib.rs
1//! # serial-io: A serial port IO library
2//!
3//! serial-io is a fork of [mio-serial](https://github.com/berkowski/mio-serial) with
4//! support for the [tokio runtime](https://tokio.rs/).
5//! It combines therefore [tokio-serial](https://github.com/berkowski/tokio-serial) and adds support
6//! for tokio version 1.
7//!
8//! serial-io provides a serial port implementation using [mio](https://github.com/carllerche/mio).
9//!
10//! **Windows support is present but largely untested by the author**
11//!
12//! ## Links
13//! - repo: <https://github.com/tarnadas/serial-io>
14//! - docs: <https://docs.rs/serial-io>
15
16#![deny(missing_docs)]
17#![warn(rust_2018_idioms)]
18
19#[cfg(feature = "tokio")]
20extern crate tokio_crate as tokio;
21
22// Enums, Structs, and Traits from the serialport crate
23pub use serialport::{
24 available_ports, new as build, ClearBuffer, DataBits, Error, ErrorKind, FlowControl, Parity,
25 SerialPort, SerialPortBuilder, SerialPortInfo, StopBits,
26};
27
28#[cfg(unix)]
29mod unix;
30
31#[cfg(windows)]
32mod windows;
33
34#[cfg(unix)]
35pub use unix::Serial;
36
37#[cfg(all(unix, feature = "tokio"))]
38pub use unix::tokio::AsyncSerial;
39
40#[cfg(windows)]
41pub use windows::Serial;
42
43/// A type for results generated by interacting with serial ports.
44pub type Result<T> = serialport::Result<T>;