pub struct VgaBuffer { /* private fields */ }Expand description
Containa a pointer to slice of Vga buffer.
Implementations§
source§impl VgaBuffer
impl VgaBuffer
pub const VGA_ADDR: usize = 753_664usize
pub const WIDTH: usize = 80usize
pub const HIGH: usize = 25usize
pub const LENGTH: usize = 2_000usize
pub const VGA_PTR: *mut VgaChar = {0xb8000 as *mut VgaChar}
sourcepub const fn to_index(y: usize, x: usize) -> usize
pub const fn to_index(y: usize, x: usize) -> usize
This static methode converts 2D index to 1D index.
sourcepub const fn to_yx(index: usize) -> (usize, usize)
pub const fn to_yx(index: usize) -> (usize, usize)
This static methode converts 1D index to 2D index.
sourcepub unsafe fn set_vgachar(&mut self, vchar: VgaChar, y: usize, x: usize)
pub unsafe fn set_vgachar(&mut self, vchar: VgaChar, y: usize, x: usize)
Set VgaChar to (y,x) coordinates. Uncheck range.
sourcepub unsafe fn get_vgachar(&self, y: usize, x: usize) -> VgaChar
pub unsafe fn get_vgachar(&self, y: usize, x: usize) -> VgaChar
Get VgaChar at (y,x) coordinates. Uncheck range.
sourcepub fn as_mut_slice<'a>(&mut self) -> &'a mut [VgaChar]
pub fn as_mut_slice<'a>(&mut self) -> &'a mut [VgaChar]
Video buffer to a mutable slice.
let buffer_slice=VgaBuffer::new().as_mut_slice(); // No error because lifetime of slice is free from VgaBuffer.
for vchar_ref in buffer.iter_mut()
{
let vchar = vchar_ref.get_volatile();
vchar_ref.set_volatile(vchar & 0xff00);
}Trait Implementations§
source§impl VgaBufferHal for VgaBuffer
impl VgaBufferHal for VgaBuffer
impl Copy for VgaBuffer
Auto Trait Implementations§
impl RefUnwindSafe for VgaBuffer
impl !Send for VgaBuffer
impl !Sync for VgaBuffer
impl Unpin for VgaBuffer
impl UnwindSafe for VgaBuffer
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