pub trait Display: DrawTarget {
// Required methods
fn buffer(&self) -> &[u8];
fn get_mut_buffer(&mut self) -> &mut [u8];
fn set_rotation(&mut self, rotation: DisplayRotation);
fn rotation(&self) -> DisplayRotation;
fn is_inverted(&self) -> bool;
// Provided methods
fn clear_buffer(&mut self, background_color: Color) { ... }
fn draw_helper(
&mut self,
width: u32,
height: u32,
pixel: Pixel<BinaryColor>,
) -> Result<(), Self::Error> { ... }
}Expand description
Necessary traits for all displays to implement for drawing
Adds support for:
- Drawing (With the help of DrawTarget/Embedded Graphics)
- Rotations
- Clearing
Required Methods§
Sourcefn get_mut_buffer(&mut self) -> &mut [u8]
fn get_mut_buffer(&mut self) -> &mut [u8]
Returns a mutable buffer
Sourcefn set_rotation(&mut self, rotation: DisplayRotation)
fn set_rotation(&mut self, rotation: DisplayRotation)
Sets the rotation of the display
Sourcefn rotation(&self) -> DisplayRotation
fn rotation(&self) -> DisplayRotation
Get the current rotation of the display
Sourcefn is_inverted(&self) -> bool
fn is_inverted(&self) -> bool
If the color for this display is inverted
Provided Methods§
Sourcefn clear_buffer(&mut self, background_color: Color)
fn clear_buffer(&mut self, background_color: Color)
Clears the buffer of the display with the chosen background color
Sourcefn draw_helper(
&mut self,
width: u32,
height: u32,
pixel: Pixel<BinaryColor>,
) -> Result<(), Self::Error>
fn draw_helper( &mut self, width: u32, height: u32, pixel: Pixel<BinaryColor>, ) -> Result<(), Self::Error>
Helper function for the Embedded Graphics draw trait
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.