serial_core

Trait SerialIo

Source
pub trait SerialIo:
    AsyncRead
    + AsyncWrite
    + Send
    + InspectMut
    + Unpin {
    // Required methods
    fn is_connected(&self) -> bool;
    fn poll_connect(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>;
    fn poll_disconnect(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>;
}
Expand description

Trait for types providing serial IO.

Required Methods§

Source

fn is_connected(&self) -> bool

Returns true if the backend is already connected.

Source

fn poll_connect(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>

Polls for the serial backend to connect.

When the serial backend disconnects, [AsyncRead::poll_read] should return Ok(0).

Source

fn poll_disconnect(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>

Polls for the serial backend to disconnect.

Implementors§

Source§

impl SerialIo for Disconnected

Source§

impl<T: SerialIo + Unpin> SerialIo for DetachableIo<T>

Source§

impl<T: AsyncRead + AsyncWrite + Send + Unpin> SerialIo for Connected<T>