Trait SerialPort

Source
pub trait SerialPort:
    Send
    + Write
    + Read {
Show 17 methods // Required methods fn reconfigure_port(&mut self) -> SerialResult<()>; fn close(self) -> SerialResult<()>; fn set_buffer_size( &mut self, rx_size: usize, tx_size: usize, ) -> SerialResult<()>; fn set_output_flow_control(&self, enable: bool) -> SerialResult<()>; fn set_data_terminal_ready(&mut self, enable: bool) -> SerialResult<()>; fn set_request_to_send(&mut self, enable: bool) -> SerialResult<()>; fn set_break_state(&mut self, enable: bool) -> SerialResult<()>; fn read_clear_to_send(&self) -> SerialResult<bool>; fn read_data_set_ready(&self) -> SerialResult<bool>; fn read_ring_indicator(&self) -> SerialResult<bool>; fn read_carrier_detect(&self) -> SerialResult<bool>; fn bytes_to_read(&self) -> SerialResult<usize>; fn bytes_to_write(&self) -> SerialResult<usize>; fn get_path(&self) -> String; fn try_clone(&mut self) -> SerialResult<Box<dyn SerialPort>>; fn clear_input_buffer(&mut self) -> SerialResult<()>; fn clear_output_buffer(&mut self) -> SerialResult<()>;
}
Expand description

Serial port trait

Required Methods§

Source

fn reconfigure_port(&mut self) -> SerialResult<()>

Reconfigures an open port with the current settings

Source

fn close(self) -> SerialResult<()>

Closes the port

Source

fn set_buffer_size( &mut self, rx_size: usize, tx_size: usize, ) -> SerialResult<()>

Sets Tx and Rx buffer size. A sensible value for these is 4096 bytes

Source

fn set_output_flow_control(&self, enable: bool) -> SerialResult<()>

Sets flow control state manually

Source

fn set_data_terminal_ready(&mut self, enable: bool) -> SerialResult<()>

Sets data terminal flag

Source

fn set_request_to_send(&mut self, enable: bool) -> SerialResult<()>

Sets request to send flag

Source

fn set_break_state(&mut self, enable: bool) -> SerialResult<()>

Sets break state flag

Source

fn read_clear_to_send(&self) -> SerialResult<bool>

Reads clear to send flag

Source

fn read_data_set_ready(&self) -> SerialResult<bool>

Reads data set ready flag

Source

fn read_ring_indicator(&self) -> SerialResult<bool>

Reads ring indicator flag

Source

fn read_carrier_detect(&self) -> SerialResult<bool>

Reads carrier detect flag

Source

fn bytes_to_read(&self) -> SerialResult<usize>

Returns number of bytes left to read in serial buffer

Source

fn bytes_to_write(&self) -> SerialResult<usize>

Returns number of bytes left to write in serial buffer

Source

fn get_path(&self) -> String

Gets the path of the port

Source

fn try_clone(&mut self) -> SerialResult<Box<dyn SerialPort>>

Tries to clone the port.

§Note about cloning

You must be careful when cloning a port as this can have interesting effects. For example, if one thread tries to close the port but another thread wants the port open

Source

fn clear_input_buffer(&mut self) -> SerialResult<()>

Clears serial input buffer

Source

fn clear_output_buffer(&mut self) -> SerialResult<()>

Clears serial output buffer

Implementors§