Use associated type for Message in a canvas::Program
This commit is contained in:
parent
12c1a3f829
commit
c52fd089f1
7 changed files with 37 additions and 24 deletions
|
|
@ -104,7 +104,9 @@ mod bezier {
|
|||
curves: &'a [Curve],
|
||||
}
|
||||
|
||||
impl<'a> canvas::Program<Curve> for Bezier<'a> {
|
||||
impl<'a> canvas::Program for Bezier<'a> {
|
||||
type Message = Curve;
|
||||
|
||||
fn update(
|
||||
&mut self,
|
||||
event: Event,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@ impl Application for Clock {
|
|||
}
|
||||
}
|
||||
|
||||
impl canvas::Program<Message> for Clock {
|
||||
impl canvas::Program for Clock {
|
||||
type Message = Message;
|
||||
|
||||
fn draw(&self, bounds: Rectangle, _cursor: Cursor) -> Vec<Geometry> {
|
||||
let clock = self.clock.draw(bounds.size(), |frame| {
|
||||
let center = frame.center();
|
||||
|
|
|
|||
|
|
@ -235,7 +235,9 @@ impl Theme {
|
|||
}
|
||||
}
|
||||
|
||||
impl canvas::Program<Message> for Theme {
|
||||
impl canvas::Program for Theme {
|
||||
type Message = Message;
|
||||
|
||||
fn draw(&self, bounds: Rectangle, _cursor: Cursor) -> Vec<Geometry> {
|
||||
let theme = self.canvas_cache.draw(bounds.size(), |frame| {
|
||||
self.draw(frame);
|
||||
|
|
|
|||
|
|
@ -328,7 +328,9 @@ mod grid {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> canvas::Program<Message> for Grid {
|
||||
impl<'a> canvas::Program for Grid {
|
||||
type Message = Message;
|
||||
|
||||
fn update(
|
||||
&mut self,
|
||||
event: Event,
|
||||
|
|
|
|||
|
|
@ -128,7 +128,9 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
impl<Message> canvas::Program<Message> for State {
|
||||
impl canvas::Program for State {
|
||||
type Message = Message;
|
||||
|
||||
fn draw(
|
||||
&self,
|
||||
bounds: Rectangle,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue