pub trait Pixel: Pod {
const DESCRIPTOR: PixelDescriptor;
}Expand description
Compile-time pixel format descriptor.
Implemented for pixel types to associate them with their
PixelDescriptor. This enables typed PixelSlice construction
where the type system enforces format correctness.
The trait is open (not sealed) — custom pixel types can implement it.
The new_typed() constructors include a compile-time assertion that
size_of::<P>() == P::DESCRIPTOR.bytes_per_pixel() to catch bad impls.
Required Associated Constants§
Sourceconst DESCRIPTOR: PixelDescriptor
const DESCRIPTOR: PixelDescriptor
The pixel format descriptor for this type.
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.