pub unsafe trait Source {
// Required methods
fn dims(&self) -> Dims;
fn format(&self) -> Format;
fn pitch(&self) -> usize;
unsafe fn row_ptr(&self, y: u32) -> *const u8;
// Provided method
unsafe fn read_raw(&self, x: u32, y: u32) -> u32 { ... }
}Expand description
A surface that a Canvas can copy from.
§Safety
Implementors must guarantee that, for every y < dims().h, Self::row_ptr
returns a pointer to at least dims().w * format().bytes_per_pixel()
readable bytes, and that the pointer stays valid for as long as self is
borrowed.
Required Methods§
fn dims(&self) -> Dims
fn format(&self) -> Format
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".