StaticPixelDisplay

Struct StaticPixelDisplay 

Source
pub struct StaticPixelDisplay<T: Pixel, const WIDTH: usize, const HEIGHT: usize> { /* private fields */ }
Expand description

Represents a console display with a width and height in pixels.

Implementations§

Source§

impl<T: Pixel, const WIDTH: usize, const HEIGHT: usize> StaticPixelDisplay<T, WIDTH, HEIGHT>

Source

pub fn new(fill: T::U) -> Self
where [(); { _ }]:,

Convenience method to create a blank display struct with specified dimensions known at compile time.

Source

pub fn new_from_data(data: &[T::U; { _ }]) -> Self
where [(); { _ }]:,

Creates a display struct from the given data with the specified dimensions known at compile time.

Trait Implementations§

Source§

impl<S: Pixel, const WIDTH: usize, const HEIGHT: usize> DynamicCanvas<S> for StaticPixelDisplay<S, WIDTH, HEIGHT>

Source§

type A = usize

Source§

fn pixel(&self, x: Self::A, y: Self::A) -> Result<S::U, String>
where [(); { _ }]:,

Returns a bool representing the state of the pixel at the specified coordinate. Read more
Source§

fn set_pixel( &mut self, x: Self::A, y: Self::A, value: S::U, ) -> Result<(), String>
where [(); { _ }]:,

Set a pixel at the specified coordinate with a given value. Read more
Source§

fn draw<D: DynamicDrawable<N>, const N: usize>( &mut self, drawable: &D, value: S::U, )
where Self: Sized, [(); { _ }]:,

Draw a drawable/shape onto a canvas with the specified pixel type/brush. Convenience method for inversing DynamicDrawable::draw by using double dispatch.
Source§

impl<T: Pixel, const WIDTH: usize, const HEIGHT: usize> DynamicConsoleDisplay<T> for StaticPixelDisplay<T, WIDTH, HEIGHT>

Source§

fn width(&self) -> usize

Returns the width of the display in a display specific, individually addressable unit (e.g. pixels, characters).
Source§

fn height(&self) -> usize

Returns the height of the display in a display specific, individually addressable unit (e.g. pixels, characters).
Source§

fn data(&self) -> &[T]

Source§

fn data_mut(&mut self) -> &mut Box<[T]>

Source§

fn pixels(&self) -> Vec<T::U>
where [(); { _ }]:,

Returns a vector containing all the pixels in the display. Read more
Source§

fn set_pixels(&mut self, data: &[T::U]) -> Result<(), String>
where [(); { _ }]:,

Sets the pixels of the display to the provided data. Read more
Source§

impl<T: Pixel, const WIDTH: usize, const HEIGHT: usize> DynamicWidget for StaticPixelDisplay<T, WIDTH, HEIGHT>

Source§

fn width_characters(&self) -> usize

Returns the width of the display in characters.
Source§

fn height_characters(&self) -> usize

Returns the height of the display in characters.
Source§

fn string_data(&self) -> StringData

Returns a string representation. The first vector contains rows. The vectors inside/rows contain individual characters.
Source§

impl<T: Pixel, const WIDTH: usize, const HEIGHT: usize> StaticConsoleDisplay<T> for StaticPixelDisplay<T, WIDTH, HEIGHT>

Source§

const WIDTH: usize = WIDTH

Source§

const HEIGHT: usize = HEIGHT

Source§

fn pixel_static<const X: usize, const Y: usize>(&self) -> T::U
where [(); { _ }]:,

Returns a bool representing the state of the pixel at the specified coordinate. Read more
Source§

fn set_pixel_static<const X: usize, const Y: usize>(&mut self, value: T::U)
where [(); { _ }]:,

Set a pixel at the specified coordinate with a given value. Read more
Source§

impl<T: Pixel, const WIDTH: usize, const HEIGHT: usize> StaticWidget for StaticPixelDisplay<T, WIDTH, HEIGHT>

Source§

const WIDTH_CHARACTERS: usize

Width of the display in characters.
Source§

const HEIGHT_CHARACTERS: usize

Height of the display in characters.

Auto Trait Implementations§

§

impl<T, const WIDTH: usize, const HEIGHT: usize> Freeze for StaticPixelDisplay<T, WIDTH, HEIGHT>

§

impl<T, const WIDTH: usize, const HEIGHT: usize> RefUnwindSafe for StaticPixelDisplay<T, WIDTH, HEIGHT>
where T: RefUnwindSafe,

§

impl<T, const WIDTH: usize, const HEIGHT: usize> Send for StaticPixelDisplay<T, WIDTH, HEIGHT>
where T: Send,

§

impl<T, const WIDTH: usize, const HEIGHT: usize> Sync for StaticPixelDisplay<T, WIDTH, HEIGHT>
where T: Sync,

§

impl<T, const WIDTH: usize, const HEIGHT: usize> Unpin for StaticPixelDisplay<T, WIDTH, HEIGHT>

§

impl<T, const WIDTH: usize, const HEIGHT: usize> UnwindSafe for StaticPixelDisplay<T, WIDTH, HEIGHT>
where T: 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.