DynamicPixelDisplay

Struct DynamicPixelDisplay 

Source
pub struct DynamicPixelDisplay<T: Pixel> { /* private fields */ }

Implementations§

Source§

impl<T: Pixel> DynamicPixelDisplay<T>

Source

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

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: &[T::U], ) -> Result<Self, String>
where Self: Sized, [(); { _ }]:,

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> DynamicCanvas<S> for DynamicPixelDisplay<S>

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> DynamicConsoleDisplay<T> for DynamicPixelDisplay<T>

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> DynamicWidget for DynamicPixelDisplay<T>

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<T> Freeze for DynamicPixelDisplay<T>

§

impl<T> RefUnwindSafe for DynamicPixelDisplay<T>
where T: RefUnwindSafe,

§

impl<T> Send for DynamicPixelDisplay<T>
where T: Send,

§

impl<T> Sync for DynamicPixelDisplay<T>
where T: Sync,

§

impl<T> Unpin for DynamicPixelDisplay<T>

§

impl<T> UnwindSafe for DynamicPixelDisplay<T>
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.