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§
Required Associated Types§
Required Methods§
fn pixels(&self) -> &[Self::U; { _ }]
fn pixels_mut(&mut self) -> &mut [Self::U; { _ }]
fn new(pixels: [Self::U; { _ }]) -> Self
Provided Methods§
Sourcefn subpixel(&self, x: usize, y: usize) -> Result<Self::U, String>
fn subpixel(&self, x: usize, y: usize) -> Result<Self::U, String>
Returns the value of the block at the specified coordinates.
§Errors
Returns an error, if the coordinates are out of bounds.
Sourcefn set_subpixel(
&mut self,
x: usize,
y: usize,
value: Self::U,
) -> Result<(), String>
fn set_subpixel( &mut self, x: usize, y: usize, value: Self::U, ) -> Result<(), String>
Returns the value of the block at the specified coordinates.
§Errors
Returns an error, if the coordinates are out of bounds.
Sourcefn build(args: &[Self::U]) -> Result<Self, String>
fn build(args: &[Self::U]) -> Result<Self, String>
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.
fn subpixel_static<const X: usize, const Y: usize>(&self) -> Self::U
fn set_subpixel_static<const X: usize, const Y: usize>( &mut self, value: Self::U, )
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.