pub struct SoftwareFlowControl<T> { /* private fields */ }
Expand description
Add software flow control to a UART device.
Flow control is performed using XON/XOFF bytes.
Implementations§
Trait Implementations§
Source§impl<T: Uart> Uart for SoftwareFlowControl<T>
impl<T: Uart> Uart for SoftwareFlowControl<T>
Source§fn set_baudrate(&self, baudrate: u32) -> Result<()>
fn set_baudrate(&self, baudrate: u32) -> Result<()>
Sets the UART baudrate. May do nothing for virtual UARTs.
Source§fn clear_rx_buffer(&self) -> Result<()>
fn clear_rx_buffer(&self) -> Result<()>
Clears the UART RX buffer.
Source§fn get_baudrate(&self) -> Result<u32>
fn get_baudrate(&self) -> Result<u32>
Returns the UART baudrate. May return zero for virtual UARTs.
fn get_flow_control(&self) -> Result<FlowControl>
Source§fn set_flow_control(&self, flow_control: bool) -> Result<()>
fn set_flow_control(&self, flow_control: bool) -> Result<()>
Enables software flow control for
write
s.Source§fn get_device_path(&self) -> Result<String>
fn get_device_path(&self) -> Result<String>
Returns
"/dev/ttyUSBn"
or similar OS device path usable by external programs for
directly accessing the serial port.Source§fn poll_read(&self, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll<Result<usize>>
fn poll_read(&self, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll<Result<usize>>
Reads UART receive data into
buf
, returning the number of bytes read. Read morefn set_break(&self, enable: bool) -> Result<()>
fn set_parity(&self, parity: Parity) -> Result<()>
Source§fn read(&self, buf: &mut [u8]) -> Result<usize>
fn read(&self, buf: &mut [u8]) -> Result<usize>
Reads UART receive data into
buf
, returning the number of bytes read.
This function is blocking.Source§fn read_timeout(&self, buf: &mut [u8], timeout: Duration) -> Result<usize>
fn read_timeout(&self, buf: &mut [u8], timeout: Duration) -> Result<usize>
Reads UART receive data into
buf
, returning the number of bytes read.
The timeout
may be used to specify a duration to wait for data.
If timeout expires without any data arriving Ok(0)
will be returned, never Err(_)
.fn get_parity(&self) -> Result<Parity>
Auto Trait Implementations§
impl<T> !Freeze for SoftwareFlowControl<T>
impl<T> !RefUnwindSafe for SoftwareFlowControl<T>
impl<T> Send for SoftwareFlowControl<T>where
T: Send,
impl<T> !Sync for SoftwareFlowControl<T>
impl<T> Unpin for SoftwareFlowControl<T>where
T: Unpin,
impl<T> UnwindSafe for SoftwareFlowControl<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more