Trait Program
pub trait Program<Message> {
type State: Default + 'static;
type Primitive: Primitive + 'static;
// Required method
fn draw(
&self,
state: &Self::State,
cursor: Cursor,
bounds: Rectangle,
) -> Self::Primitive;
// Provided methods
fn update(
&self,
_state: &mut Self::State,
_event: Event,
_bounds: Rectangle,
_cursor: Cursor,
) -> Option<Action<Message>> { ... }
fn mouse_interaction(
&self,
_state: &Self::State,
_bounds: Rectangle,
_cursor: Cursor,
) -> Interaction { ... }
}
Available on crate feature
wgpu
only.