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§
Sourcefn 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 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.