Struct rstubs::device::cga::Window

source ·
pub struct Window {
    cursor: (u8, u8),
    hw_cursor: bool,
    rect: Rect,
    pub style: Attribute,
}
Expand description

The screen represents the cga screen or a part of it.

This class provides an interface to access the screen in text mode (also known as CGA mode), with access directly on the hardware level, i.e. the video memory and the I/O ports of the graphics card.

There can be multiple screes to different areas of the cga. However, only one of them should control the hw_cursor at the same time.

Fields§

§cursor: (u8, u8)

Cursor position

§hw_cursor: bool

If the hardware cursor should be used

§rect: Rect

Size of the screen

§style: Attribute

Style

Implementations§

source§

impl Window

source

pub const fn whole() -> Window

Create a window filling the whole screen.

source

pub const fn new(rect: Rect) -> Window

Create a window with the given bounds.

source

pub const fn with_hw_cursor(self) -> Self

Configure the window to use the hardware cursor.

source

pub const fn with_style(self, attr: Attribute) -> Self

Configures the screen to use the given style.

source

pub fn clear(&mut self)

Clear the whole screen.

source

pub fn fill(&mut self, cell: Cell)

Fill the whole screen with the given character.

source

pub fn set_cursor(&mut self, pos: (u8, u8))

Move the cursor to pos

source

pub fn get_cursor(&mut self) -> (u8, u8)

Returns the cursor position.

source

fn set(&mut self, pos: (u8, u8), cell: Cell)

Overwrite the character at the given pos

source

fn get(&self, pos: (u8, u8)) -> Cell

Get the character at the given pos

Trait Implementations§

source§

impl Debug for Window

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Write for Window

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a [char] into this writer, returning whether the write succeeded. Read more
1.0.0§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the [write!] macro with implementors of this trait. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Window

§

impl Send for Window

§

impl Sync for Window

§

impl Unpin for Window

§

impl UnwindSafe for Window

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.