pub struct SerialPortBuilder { /* private fields */ }Expand description
A struct containing all serial port settings
Implementations§
Source§impl SerialPortBuilder
impl SerialPortBuilder
Sourcepub fn path<'a>(self, path: impl Into<Cow<'a, str>>) -> SerialPortBuilder
pub fn path<'a>(self, path: impl Into<Cow<'a, str>>) -> SerialPortBuilder
Set the path to the serial port
Sourcepub fn baud_rate(self, baud_rate: u32) -> SerialPortBuilder
pub fn baud_rate(self, baud_rate: u32) -> SerialPortBuilder
Set the baud rate in symbols-per-second
Sourcepub fn data_bits(self, data_bits: DataBits) -> SerialPortBuilder
pub fn data_bits(self, data_bits: DataBits) -> SerialPortBuilder
Set the number of bits used to represent a character sent on the line
Sourcepub fn flow_control(self, flow_control: FlowControl) -> SerialPortBuilder
pub fn flow_control(self, flow_control: FlowControl) -> SerialPortBuilder
Set the type of signalling to use for controlling data transfer
Sourcepub fn parity(self, parity: Parity) -> SerialPortBuilder
pub fn parity(self, parity: Parity) -> SerialPortBuilder
Set the type of parity to use for error checking
Sourcepub fn stop_bits(self, stop_bits: StopBits) -> SerialPortBuilder
pub fn stop_bits(self, stop_bits: StopBits) -> SerialPortBuilder
Set the number of bits to use to signal the end of a character
Sourcepub fn timeout(self, timeout: Duration) -> SerialPortBuilder
pub fn timeout(self, timeout: Duration) -> SerialPortBuilder
Set the amount of time to wait to receive data before timing out
The accuracy is limited by the underlying platform’s capabilities. Longer timeouts will be clamped to the maximum supported value which is expected to be in the magnitude of a few days.
Sourcepub fn dtr_on_open(self, state: bool) -> SerialPortBuilder
pub fn dtr_on_open(self, state: bool) -> SerialPortBuilder
Set data terminal ready (DTR) to the given state when opening the device
Note: On Linux, DTR is automatically set on open. Even if you set dtr_on_open to false,
DTR will be asserted for a short moment when opening the port. This can’t be prevented
without kernel modifications.
Sourcepub fn preserve_dtr_on_open(self) -> SerialPortBuilder
pub fn preserve_dtr_on_open(self) -> SerialPortBuilder
Preserve the state of data terminal ready (DTR) when opening the device. Your outcome may vary depending on the operation system. For example, Linux sets DTR by default and Windows doesn’t.
Sourcepub fn open(self) -> Result<Box<dyn SerialPort>, Error>
pub fn open(self) -> Result<Box<dyn SerialPort>, Error>
Open a cross-platform interface to the port with the specified settings
Sourcepub fn open_native(self) -> Result<TTYPort, Error>
pub fn open_native(self) -> Result<TTYPort, Error>
Open a platform-specific interface to the port with the specified settings
Trait Implementations§
Source§impl Clone for SerialPortBuilder
impl Clone for SerialPortBuilder
Source§fn clone(&self) -> SerialPortBuilder
fn clone(&self) -> SerialPortBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SerialPortBuilder
impl Debug for SerialPortBuilder
Source§impl PartialEq for SerialPortBuilder
impl PartialEq for SerialPortBuilder
Source§impl SerialPortBuilderExt for SerialPortBuilder
impl SerialPortBuilderExt for SerialPortBuilder
Source§fn open_native_async(self) -> Result<SerialStream, Error>
fn open_native_async(self) -> Result<SerialStream, Error>
Open a platform-specific interface to the port with the specified settings
Source§impl SerialPortBuilderExt for SerialPortBuilder
impl SerialPortBuilderExt for SerialPortBuilder
Source§fn open_native_async(self) -> Result<SerialStream>
fn open_native_async(self) -> Result<SerialStream>
Open a platform-specific interface to the port with the specified settings