pub trait Drawable {
// Required methods
fn draw<T: Drawer>(&self, window: &mut T);
fn draw_with_context(&self, context: &mut Context<'_>);
fn update(&mut self);
// Provided method
fn setup_draw(&self, context: &mut Context<'_>) { ... }
}Expand description
Trait that can be use to draw on window
Required Methods§
Sourcefn draw<T: Drawer>(&self, window: &mut T)
fn draw<T: Drawer>(&self, window: &mut T)
Draw the drawable structure, you need a Drawer(Where the struct will be draw)
Sourcefn draw_with_context(&self, context: &mut Context<'_>)
fn draw_with_context(&self, context: &mut Context<'_>)
Draw with a particular context
Provided Methods§
Sourcefn setup_draw(&self, context: &mut Context<'_>)
fn setup_draw(&self, context: &mut Context<'_>)
Setup the draw for the final system you don’t have to implement it in a normal drawable
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".