Function serialport::new
source · pub fn new<'a>(
path: impl Into<Cow<'a, str>>,
baud_rate: u32
) -> SerialPortBuilder
Expand description
Construct a builder of SerialPort
objects
SerialPort
objects are built using the Builder pattern through the new
function. The
resultant SerialPortBuilder
object can be copied, reconfigured, and saved making working with
multiple serial ports a little easier.
To open a new serial port:
serialport::new("/dev/ttyUSB0", 9600).open().expect("Failed to open port");