pub struct VirtIOConsole<'a, H: Hal, T: Transport> { /* private fields */ }
Expand description

Driver for a VirtIO console device.

Only a single port is allowed since alloc is disabled. Emergency write and cols/rows are not implemented.

Example

use virtio_drivers::device::console::VirtIOConsole;
let mut console = VirtIOConsole::<HalImpl, _>::new(transport)?;

let info = console.info();
println!("VirtIO console {}x{}", info.rows, info.columns);

for &c in b"Hello console!\n" {
  console.send(c)?;
}

let c = console.recv(true)?;
println!("Read {:?} from console.", c);

Implementations§

Creates a new VirtIO console driver.

Returns a struct with information about the console device, such as the number of rows and columns.

Acknowledges a pending interrupt, if any, and completes the outstanding finished read request if there is one.

Returns true if new data has been received.

Returns the next available character from the console, if any.

If no data has been received this will not block but immediately return Ok<None>.

Sends a character to the console.

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.