CharacterPixel

Struct CharacterPixel 

Source
pub struct CharacterPixel { /* private fields */ }

Implementations§

Source§

impl CharacterPixel

Source

pub fn new<const CHARACTER: char>( foreground: TerminalColor, background: TerminalColor, ) -> Self
where [(); { _ }]:,

Constructs a character pixel from a char, a foreground and a background color.

§Panics

This function checks for control characters at compile time. Panics when the compile time checks miss a control character. This should not happen and is a implementation detail that is subject to change.

Source

pub fn build( character: char, foreground: TerminalColor, background: TerminalColor, ) -> Result<Self, String>

Constructs a character pixel from a char, a foreground and a background color.

§Errors

Returns an error if the character is a control character.

Source

pub const fn make_copy(&self) -> Self

Source

pub const fn character(&self) -> char

Source

pub const fn foreground(&self) -> TerminalColor

Source

pub const fn background(&self) -> TerminalColor

Source

pub const fn is_copy(&self) -> bool

Source

pub const fn width(&self) -> usize

Trait Implementations§

Source§

impl Clone for CharacterPixel

Source§

fn clone(&self) -> CharacterPixel

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 Debug for CharacterPixel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CharacterPixel

Source§

fn default() -> CharacterPixel

Returns the “default value” for a type. Read more
Source§

impl Display for CharacterPixel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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 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<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 From<CharacterPixel> for CharacterPixelData

Source§

fn from(value: CharacterPixel) -> Self

Converts to this type from the input type.
Source§

impl From<CharacterPixel> for DataCell

Source§

fn from(val: CharacterPixel) -> Self

Converts to this type from the input type.
Source§

impl Pixel for CharacterPixel

Source§

const WIDTH: usize = 1usize

The width of the block of pixels.
Source§

const HEIGHT: usize = 1usize

The height of the block of pixels.
Source§

type U = CharacterPixelData

Source§

fn pixels(&self) -> &[Self::U; 1]

Source§

fn pixels_mut(&mut self) -> &mut [Self::U; 1]

Source§

fn new(pixels: [Self::U; 1]) -> Self

Source§

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

Returns the value of the block at the specified coordinates. Read more
Source§

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

Returns the value of the block at the specified coordinates. Read more
Source§

fn build(args: &[Self::U]) -> Result<Self, String>
where [(); { _ }]:,

Builds a block of pixels from a slice of pixels. Read more
Source§

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

Source§

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

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 TryFrom<char> for CharacterPixel

Source§

type Error = String

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

fn try_from(value: char) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for CharacterPixel

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.