Struct GraphicsConsole

Source
pub struct GraphicsConsole<IO, RO>
where RO: RasterOps,
{ /* private fields */ }
Expand description

Implementation of a console that renders to a backing surface.

Implementations§

Source§

impl<IO, RO> GraphicsConsole<IO, RO>
where IO: InputOps, RO: RasterOps,

Source

pub fn new(input_ops: IO, raster_ops: RO) -> Result<Self>

Initializes a new graphical console.

Trait Implementations§

Source§

impl<IO, RO> Console for GraphicsConsole<IO, RO>
where IO: InputOps, RO: RasterOps,

Source§

fn clear(&mut self, how: ClearType) -> Result<()>

Clears the part of the console given by how.
Source§

fn color(&self) -> (Option<u8>, Option<u8>)

Gets the console’s current foreground and background colors.
Source§

fn set_color(&mut self, fg: Option<u8>, bg: Option<u8>) -> Result<()>

Sets the console’s foreground and background colors to fg and bg. Read more
Source§

fn enter_alt(&mut self) -> Result<()>

Enters the alternate console.
Source§

fn hide_cursor(&mut self) -> Result<()>

Hides the cursor.
Source§

fn is_interactive(&self) -> bool

Returns true if the console is attached to an interactive terminal. This controls whether reading a line echoes back user input, for example.
Source§

fn leave_alt(&mut self) -> Result<()>

Leaves the alternate console.
Source§

fn locate(&mut self, pos: CharsXY) -> Result<()>

Moves the cursor to the given position, which must be within the screen.
Source§

fn move_within_line(&mut self, off: i16) -> Result<()>

Moves the cursor within the line. Positive values move right, negative values move left.
Source§

fn print(&mut self, text: &str) -> Result<()>

Writes text to the console, followed by a newline or CRLF pair depending on the needs of the console to advance a line. Read more
Source§

fn poll_key<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<Key>>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the next key press if any is available.
Source§

fn read_key<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Key>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Waits for and returns the next key press.
Source§

fn show_cursor(&mut self) -> Result<()>

Shows the cursor.
Source§

fn size_chars(&self) -> Result<CharsXY>

Queries the size of the text console. Read more
Source§

fn size_pixels(&self) -> Result<SizeInPixels>

Queries the size of the graphical console.
Source§

fn write(&mut self, text: &str) -> Result<()>

Writes the text into the console at the position of the cursor.
Source§

fn draw_circle(&mut self, center: PixelsXY, radius: u16) -> Result<()>

Draws the outline of a circle at _center with _radius using the current drawing color.
Source§

fn draw_circle_filled(&mut self, center: PixelsXY, radius: u16) -> Result<()>

Draws a filled circle at _center with _radius using the current drawing color.
Source§

fn draw_line(&mut self, x1y1: PixelsXY, x2y2: PixelsXY) -> Result<()>

Draws a line from _x1y1 to _x2y2 using the current drawing color.
Source§

fn draw_pixel(&mut self, xy: PixelsXY) -> Result<()>

Draws a single pixel at _xy using the current drawing color.
Source§

fn draw_rect(&mut self, x1y1: PixelsXY, x2y2: PixelsXY) -> Result<()>

Draws the outline of a rectangle from _x1y1 to _x2y2 using the current drawing color.
Source§

fn draw_rect_filled(&mut self, x1y1: PixelsXY, x2y2: PixelsXY) -> Result<()>

Draws a filled rectangle from _x1y1 to _x2y2 using the current drawing color.
Source§

fn sync_now(&mut self) -> Result<()>

Causes any buffered output to be synced. Read more
Source§

fn set_sync(&mut self, enabled: bool) -> Result<bool>

Enables or disables video syncing. Read more

Auto Trait Implementations§

§

impl<IO, RO> Freeze for GraphicsConsole<IO, RO>
where IO: Freeze, RO: Freeze, <RO as RasterOps>::ID: Freeze,

§

impl<IO, RO> RefUnwindSafe for GraphicsConsole<IO, RO>

§

impl<IO, RO> Send for GraphicsConsole<IO, RO>
where IO: Send, RO: Send, <RO as RasterOps>::ID: Send,

§

impl<IO, RO> Sync for GraphicsConsole<IO, RO>
where IO: Sync, RO: Sync, <RO as RasterOps>::ID: Sync,

§

impl<IO, RO> Unpin for GraphicsConsole<IO, RO>
where IO: Unpin, RO: Unpin, <RO as RasterOps>::ID: Unpin,

§

impl<IO, RO> UnwindSafe for GraphicsConsole<IO, RO>
where IO: UnwindSafe, RO: UnwindSafe, <RO as RasterOps>::ID: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V