From 32fd8dadda6636b11d4a1d9f59b467e57b3706a8 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 18 Mar 2022 22:13:52 +0700 Subject: Reintroduce generic `Message` type for `canvas::Program` As it is useful to make the `Message` completely free in many implementations. --- graphics/src/widget/pure/canvas/program.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'graphics/src/widget/pure/canvas/program.rs') diff --git a/graphics/src/widget/pure/canvas/program.rs b/graphics/src/widget/pure/canvas/program.rs index cb52910d..ee74c27f 100644 --- a/graphics/src/widget/pure/canvas/program.rs +++ b/graphics/src/widget/pure/canvas/program.rs @@ -9,10 +9,7 @@ use crate::Rectangle; /// application. /// /// [`Canvas`]: crate::widget::Canvas -pub trait Program { - /// The [`Message`] produced by the [`Program`]. - type Message; - +pub trait Program { /// The internal [`State`] mutated by the [`Program`]. type State: Default + 'static; @@ -33,7 +30,7 @@ pub trait Program { _event: Event, _bounds: Rectangle, _cursor: Cursor, - ) -> (event::Status, Option) { + ) -> (event::Status, Option) { (event::Status::Ignored, None) } @@ -67,11 +64,10 @@ pub trait Program { } } -impl Program for &T +impl Program for &T where - T: Program, + T: Program, { - type Message = T::Message; type State = T::State; fn update( @@ -80,7 +76,7 @@ where event: Event, bounds: Rectangle, cursor: Cursor, - ) -> (event::Status, Option) { + ) -> (event::Status, Option) { T::update(self, state, event, bounds, cursor) } -- cgit