[][src]Function serialport::open_with_settings

pub fn open_with_settings<T: AsRef<OsStr> + ?Sized>(
    port: &T,
    settings: &SerialPortSettings
) -> Result<Box<dyn SerialPort>>

Opens the serial port specified by the device path with the given settings.

use serialport::prelude::*;
use std::time::Duration;

let s = SerialPortSettings {
    baud_rate: 9600,
    data_bits: DataBits::Eight,
    flow_control: FlowControl::None,
    parity: Parity::None,
    stop_bits: StopBits::One,
    timeout: Duration::from_millis(1),
};
serialport::open_with_settings("/dev/ttyUSB0", &s);