async-serial
Lightweight async serial port adapter — bridges [serial] with [async-io].
Quickstart
use
let mut port = open?;
port.reconfigure?;
// Async read — won't block the executor
let mut buf = ;
let n = port.read.await?;
How It Works
serial::SystemPort implements Read + Write but those are blocking calls. async-io provides an Async<T> wrapper that makes any IoSafe + AsFd type non-blocking via the reactor. This crate provides the missing IoSafe and AsFd impls in a small newtype.
API
open(path)— opens a serial port and returnsAsync<SystemPort>SystemPort::from_serial(port)— wraps an existingserial::SystemPortDeref<Target = serial::SystemPort>— transparent access to all serial methods
License
MIT OR Apache-2.0