Trait Program Copy item path
Summary Source 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 { ... }
}
Expand description The state and logic of a Shader
widget.
A Program
can mutate the internal state of a Shader
widget
and produce messages for an application.
The type of primitive this Program
can draw.
Update the internal State
of the Program
. This can be used to reflect state changes
based on mouse & other events. You can return an Action
to publish a message, request a
redraw, or capture the event.
By default, this method returns None
.
Returns the current mouse interaction of the Program
.
The interaction returned will be in effect even if the cursor position is out of
bounds of the Shader
’s program.