DynamicCharacterDisplay

Struct DynamicCharacterDisplay 

Source
pub struct DynamicCharacterDisplay<CharacterPixel> { /* private fields */ }

Implementations§

Source§

impl DynamicCharacterDisplay<CharacterPixel>

Source

pub fn new(width: usize, height: usize, fill: CharacterPixel) -> Self

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( width: usize, height: usize, data: &[CharacterPixel], ) -> Result<Self, String>

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

§Errors

Returns an error when the length of the data does not match the dimensions of the display.

Trait Implementations§

Source§

impl<S: Pixel<U = CharacterPixelData>> DynamicCanvas<S> for DynamicCharacterDisplay<CharacterPixel>

Source§

type A = usize

Source§

fn pixel(&self, x: Self::A, y: Self::A) -> Result<CharacterPixelData, 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 DynamicConsoleDisplay<CharacterPixel> for DynamicCharacterDisplay<CharacterPixel>

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 DynamicWidget for DynamicCharacterDisplay<CharacterPixel>

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.

Auto Trait Implementations§

§

impl<CharacterPixel> Freeze for DynamicCharacterDisplay<CharacterPixel>

§

impl<CharacterPixel> RefUnwindSafe for DynamicCharacterDisplay<CharacterPixel>
where CharacterPixel: RefUnwindSafe,

§

impl<CharacterPixel> Send for DynamicCharacterDisplay<CharacterPixel>
where CharacterPixel: Send,

§

impl<CharacterPixel> Sync for DynamicCharacterDisplay<CharacterPixel>
where CharacterPixel: Sync,

§

impl<CharacterPixel> Unpin for DynamicCharacterDisplay<CharacterPixel>

§

impl<CharacterPixel> UnwindSafe for DynamicCharacterDisplay<CharacterPixel>
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> 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.