StaticCharacterDisplay

Struct StaticCharacterDisplay 

Source
pub struct StaticCharacterDisplay<CharacterPixel, const WIDTH: usize, const HEIGHT: usize> { /* private fields */ }

Implementations§

Source§

impl<const WIDTH: usize, const HEIGHT: usize> StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>

Source

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

Convenience method to build a blank display struct with specified dimensions

§Panics

This function panics if the data generated from the fill does not match the dimensions of the display. This should not happen and is subject to change in the future.

Source

pub fn build_from_data(data: &[CharacterPixel]) -> Result<Self, String>

Builds a display struct with the specified dimensions from the given data.

§Errors

Returns an error when the data length does not match the dimensions of the display. This also applies if double-width characters, like あ, are used and exceed the dimensions of the display.

Trait Implementations§

Source§

impl<CharacterPixel: Clone, const WIDTH: usize, const HEIGHT: usize> Clone for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>

Source§

fn clone(&self) -> StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const WIDTH: usize, const HEIGHT: usize> DynamicCanvas<CharacterPixel> for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>

Source§

type A = usize

Source§

fn pixel(&self, x: Self::A, y: Self::A) -> Result<CharacterPixelData, String>
where [(); 1]:,

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: CharacterPixelData, ) -> Result<(), String>
where [(); 1]:,

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<const WIDTH: usize, const HEIGHT: usize> DynamicConsoleDisplay<CharacterPixel> for StaticCharacterDisplay<CharacterPixel, 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) -> &[CharacterPixel]

Source§

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

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<const WIDTH: usize, const HEIGHT: usize> DynamicWidget for StaticCharacterDisplay<CharacterPixel, 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<const WIDTH: usize, const HEIGHT: usize> StaticConsoleDisplay<CharacterPixel> for StaticCharacterDisplay<CharacterPixel, 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<const WIDTH: usize, const HEIGHT: usize> StaticWidget for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>

Source§

const WIDTH_CHARACTERS: usize = WIDTH

Width of the display in characters.
Source§

const HEIGHT_CHARACTERS: usize = HEIGHT

Height of the display in characters.

Auto Trait Implementations§

§

impl<CharacterPixel, const WIDTH: usize, const HEIGHT: usize> Freeze for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>

§

impl<CharacterPixel, const WIDTH: usize, const HEIGHT: usize> RefUnwindSafe for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>
where CharacterPixel: RefUnwindSafe,

§

impl<CharacterPixel, const WIDTH: usize, const HEIGHT: usize> Send for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>
where CharacterPixel: Send,

§

impl<CharacterPixel, const WIDTH: usize, const HEIGHT: usize> Sync for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>
where CharacterPixel: Sync,

§

impl<CharacterPixel, const WIDTH: usize, const HEIGHT: usize> Unpin for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>

§

impl<CharacterPixel, const WIDTH: usize, const HEIGHT: usize> UnwindSafe for StaticCharacterDisplay<CharacterPixel, WIDTH, HEIGHT>
where CharacterPixel: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.