Struct virtio_drivers::device::console::VirtIOConsole
source · pub struct VirtIOConsole<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§
source§impl<H: Hal, T: Transport> VirtIOConsole<H, T>
impl<H: Hal, T: Transport> VirtIOConsole<H, T>
sourcepub fn info(&self) -> ConsoleInfo
pub fn info(&self) -> ConsoleInfo
Returns a struct with information about the console device, such as the number of rows and columns.
sourcepub fn ack_interrupt(&mut self) -> Result<bool>
pub fn ack_interrupt(&mut self) -> Result<bool>
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.
Trait Implementations§
Auto Trait Implementations§
impl<H, T> RefUnwindSafe for VirtIOConsole<H, T>where H: RefUnwindSafe, T: RefUnwindSafe,
impl<H, T> !Send for VirtIOConsole<H, T>
impl<H, T> !Sync for VirtIOConsole<H, T>
impl<H, T> Unpin for VirtIOConsole<H, T>where H: Unpin, T: Unpin,
impl<H, T> UnwindSafe for VirtIOConsole<H, T>where H: UnwindSafe, T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more