pub trait DisplayPort {
type Canvas: UiCanvas;
type Error;
// Required methods
fn bounds(&self) -> Rectangle;
fn draw_frame<F>(&mut self, draw: F) -> Result<(), Self::Error>
where F: FnOnce(&mut Self::Canvas);
// Provided method
fn draw_dirty<F>(
&mut self,
dirty: Rectangle,
draw: F,
) -> Result<(), Self::Error>
where F: FnOnce(&mut Self::Canvas) { ... }
}Expand description
Drawing backend provided by an OEM target or simulator.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn draw_dirty<F>(
&mut self,
dirty: Rectangle,
draw: F,
) -> Result<(), Self::Error>
fn draw_dirty<F>( &mut self, dirty: Rectangle, draw: F, ) -> Result<(), Self::Error>
Draws only the specified dirty area.
The default implementation falls back to Self::draw_frame.
Examples found in repository?
src/system.rs (lines 156-158)
147 pub fn draw_redraw(&mut self, redraw: ViewRedraw) -> Result<(), Display::Error> {
148 match redraw {
149 ViewRedraw::None => Ok(()),
150 ViewRedraw::Full => self.draw(),
151 ViewRedraw::Dirty(area) => {
152 let env = ViewEnvironment {
153 theme: &self.theme,
154 i18n: &self.i18n,
155 };
156 self.display.draw_dirty(area, |canvas| {
157 self.root.draw(canvas, &self.registration, &env);
158 })
159 }
160 }
161 }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.