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<()>;
}

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.

Implementations on Foreign Types§

Source§

impl<T: ConsoleDevice + ?Sized> ConsoleDevice for &T

Source§

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

Writes data from buf to the UART.

Source§

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

Source§

impl<T: ConsoleDevice + ?Sized> ConsoleDevice for Rc<T>

Source§

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

Writes data from buf to the UART.

Source§

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

Implementors§