Trait ConsoleDevice

Source
pub trait ConsoleDevice {
    // Required methods
    fn poll_read(
        &self,
        cx: &mut Context<'_>,
        buf: &mut [u8],
    ) -> Poll<Result<usize>>;
    fn write(&self, buf: &[u8]) -> Result<()>;

    // Provided method
    fn as_coverage_console(&self) -> Option<&dyn CoverageConsole> { ... }
}

Required Methods§

Source

fn poll_read(&self, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll<Result<usize>>

Reads received data into buf, returning the number of bytes read.

If data is not yet ready, Poll::Pending will be returned and cx would be notified when it’s available. When this function is called with multiple wakers, all wakers should be notified instead of just the last one.

Source

fn write(&self, buf: &[u8]) -> Result<()>

Writes data from buf to the UART.

Provided Methods§

Source

fn as_coverage_console(&self) -> Option<&dyn CoverageConsole>

Returns a reference to the coverage extraction interface if supported.

Implementors§