pub struct Settings { /* private fields */ }
Expand description
The settings of a serial port.
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn set_raw(&mut self)
pub fn set_raw(&mut self)
Disable all OS level input and output processing.
All input and output processing will be disabled, and the configuration will be set for 8 bit binary communication, one stop bit, no parity checks and no flow control.
This is usually a good starting point for manual configuration.
Sourcepub fn set_baud_rate(&mut self, baud_rate: u32) -> Result<(), Error>
pub fn set_baud_rate(&mut self, baud_rate: u32) -> Result<(), Error>
Set the baud rate to be configured.
This function returns an error if the platform does not support the requested bandwidth.
Note that the device itself may also not support the requested baud rate, even if the platform does.
In that case SerialPort::set_configuration()
will return an error.
Sourcepub fn get_baud_rate(&self) -> Result<u32, Error>
pub fn get_baud_rate(&self) -> Result<u32, Error>
Get the baud rate from the configuration.
Sourcepub fn set_char_size(&mut self, char_size: CharSize)
pub fn set_char_size(&mut self, char_size: CharSize)
Set the number of bits in a character.
Sourcepub fn get_char_size(&self) -> Result<CharSize, Error>
pub fn get_char_size(&self) -> Result<CharSize, Error>
Get the number of bits in a character.
Sourcepub fn set_stop_bits(&mut self, stop_bits: StopBits)
pub fn set_stop_bits(&mut self, stop_bits: StopBits)
Set the number of stop bits following each character.
Sourcepub fn get_stop_bits(&self) -> Result<StopBits, Error>
pub fn get_stop_bits(&self) -> Result<StopBits, Error>
Get the number of stop bits following each character.
Sourcepub fn set_parity(&mut self, parity: Parity)
pub fn set_parity(&mut self, parity: Parity)
Set the partity check.
Sourcepub fn get_parity(&self) -> Result<Parity, Error>
pub fn get_parity(&self) -> Result<Parity, Error>
Get the partity check.
Sourcepub fn set_flow_control(&mut self, flow_control: FlowControl)
pub fn set_flow_control(&mut self, flow_control: FlowControl)
Set the flow control mechanism.
See the individual documentation of the FlowControl
variants for more information.
Sourcepub fn get_flow_control(&self) -> Result<FlowControl, Error>
pub fn get_flow_control(&self) -> Result<FlowControl, Error>
Get the flow control mechanism
Sourcepub fn as_termios(&self) -> &termios2
Available on crate feature unix
only.
pub fn as_termios(&self) -> &termios2
unix
only.Get a reference to the raw termios
struct.
On Linux and Android this is actually a termios2
struct.
On other Unix platforms, this is a termios
struct.
You can use this function to access Unix specific features of the serial port. Your code will not be cross-platform anymore if you use this.
Sourcepub fn as_termios_mut(&mut self) -> &mut termios2
Available on crate feature unix
only.
pub fn as_termios_mut(&mut self) -> &mut termios2
unix
only.Get a mutable reference to the raw termios
struct.
On Linux and Android this is actually a termios2
struct.
On other Unix platforms, this is a termios
struct.
You can use this function to access Unix specific features of the serial port. Your code will not be cross-platform anymore if you use this.
Sourcepub fn as_raw_dbc(&self) -> &DCB
Available on crate feature windows
only.
pub fn as_raw_dbc(&self) -> &DCB
windows
only.Get a reference to the raw DCB
struct.
You can use this function to access Windows specific features of the serial port. Your code will not be cross-platform anymore if you use this.
Sourcepub fn as_raw_dbc_mut(&mut self) -> &mut DCB
Available on crate feature windows
only.
pub fn as_raw_dbc_mut(&mut self) -> &mut DCB
windows
only.Get a mutable reference to the raw DCB
struct.
You can use this function to access Windows specific features of the serial port. Your code will not be cross-platform anymore if you use this.