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>(&'a mut self) -> &'a mut [VgaChar]
pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [VgaChar]
Video buffer to a mutable slice.
let mut vga_buffer = VgaBuffer::new()
let buffer_slice = vga_buffer.as_mut_slice();
for vchar_ref in buffer_slice.iter_mut()
{
let mut vchar = vchar_ref.get_volatile();
vchar.codepoint = 0u8;
vchar_ref.set_volatile(vchar);
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VgaBuffer
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