Pixel

Trait Pixel 

Source
pub trait Pixel: Copy + Into<DataCell>
where Self: Sized,
{ type U: Copy; const WIDTH: usize; const HEIGHT: usize; // Required methods fn pixels(&self) -> &[Self::U; { _ }]; fn pixels_mut(&mut self) -> &mut [Self::U; { _ }]; fn new(pixels: [Self::U; { _ }]) -> Self; // Provided methods fn subpixel(&self, x: usize, y: usize) -> Result<Self::U, String> where [(); { _ }]: { ... } fn set_subpixel( &mut self, x: usize, y: usize, value: Self::U, ) -> Result<(), String> where [(); { _ }]: { ... } fn build(args: &[Self::U]) -> Result<Self, String> where [(); { _ }]: { ... } fn subpixel_static<const X: usize, const Y: usize>(&self) -> Self::U where [(); { _ }]: { ... } fn set_subpixel_static<const X: usize, const Y: usize>( &mut self, value: Self::U, ) where [(); { _ }]: { ... } }

Required Associated Constants§

Source

const WIDTH: usize

The width of the block of pixels.

Source

const HEIGHT: usize

The height of the block of pixels.

Required Associated Types§

Required Methods§

Source

fn pixels(&self) -> &[Self::U; { _ }]

Source

fn pixels_mut(&mut self) -> &mut [Self::U; { _ }]

Source

fn new(pixels: [Self::U; { _ }]) -> Self

Provided Methods§

Source

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

Returns the value of the block at the specified coordinates.

§Errors

Returns an error, if the coordinates are out of bounds.

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.

§Errors

Returns an error, if the coordinates are out of bounds.

Source

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

Builds a block of pixels from a slice of pixels.

§Errors

Returns an error, if the number of pixels does not match the dimensions of the block.

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 [(); { _ }]:,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Pixel for CharacterPixel

Source§

impl Pixel for ColorDualPixel

Source§

const WIDTH: usize = 1usize

Source§

const HEIGHT: usize = 2usize

Source§

type U = TerminalColor

Source§

impl Pixel for ColorHexPixel

Source§

const WIDTH: usize = 2usize

Source§

const HEIGHT: usize = 3usize

Source§

type U = TerminalColor

Source§

impl Pixel for ColorOctPixel

Source§

const WIDTH: usize = 2usize

Source§

const HEIGHT: usize = 4usize

Source§

type U = TerminalColor

Source§

impl Pixel for ColorQuadPixel

Source§

const WIDTH: usize = 2usize

Source§

const HEIGHT: usize = 2usize

Source§

type U = TerminalColor

Source§

impl Pixel for ColorSinglePixel

Source§

const WIDTH: usize = 1usize

Source§

const HEIGHT: usize = 1usize

Source§

type U = TerminalColor

Source§

impl Pixel for BrailleOctPixel

Source§

const WIDTH: usize = 2usize

Source§

const HEIGHT: usize = 4usize

Source§

type U = bool

Source§

impl Pixel for DualPixel

Source§

const WIDTH: usize = 1usize

Source§

const HEIGHT: usize = 2usize

Source§

type U = bool

Source§

impl Pixel for HexPixel

Source§

const WIDTH: usize = 2usize

Source§

const HEIGHT: usize = 3usize

Source§

type U = bool

Source§

impl Pixel for OctPixel

Source§

const WIDTH: usize = 2usize

Source§

const HEIGHT: usize = 4usize

Source§

type U = bool

Source§

impl Pixel for QuadPixel

Source§

const WIDTH: usize = 2usize

Source§

const HEIGHT: usize = 2usize

Source§

type U = bool

Source§

impl Pixel for SinglePixel

Source§

const WIDTH: usize = 1usize

Source§

const HEIGHT: usize = 1usize

Source§

type U = bool