pub unsafe trait AsBytes: Sized {
type Bytes: AsRef<[u8]> + AsMut<[u8]> + Default + From<Self> + Into<Self>;
// Required method
fn width() -> usize;
}Expand description
Describes a kind of pixel that is made up of a fixed number of bytes.
§Safety
Perfectly safe to implement as long as the length of the byte array is
always equal to Self::width(). When the bugs in associated constants are
ironed out this will hopefully use them, and be safe to implement.
Required Associated Types§
Required Methods§
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.