diff options
author | 2024-06-14 01:47:39 +0200 | |
---|---|---|
committer | 2024-06-14 01:47:39 +0200 | |
commit | a25b1af45690bdd8e1cbb20ee3a5b1c4342de455 (patch) | |
tree | 432044cf682dd73d1019a2f964749e78db178865 /core/src/element.rs | |
parent | e6d0b3bda5042a1017a5944a5227c97e0ed6caf9 (diff) | |
download | iced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.tar.gz iced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.tar.bz2 iced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.zip |
Replace `Command` with a new `Task` API with chain support
Diffstat (limited to 'core/src/element.rs')
-rw-r--r-- | core/src/element.rs | 61 |
1 files changed, 3 insertions, 58 deletions
diff --git a/core/src/element.rs b/core/src/element.rs index 7d918a2e..385d8295 100644 --- a/core/src/element.rs +++ b/core/src/element.rs @@ -10,7 +10,6 @@ use crate::{ Widget, }; -use std::any::Any; use std::borrow::Borrow; /// A generic [`Widget`]. @@ -305,63 +304,9 @@ where tree: &mut Tree, layout: Layout<'_>, renderer: &Renderer, - operation: &mut dyn widget::Operation<B>, + operation: &mut dyn widget::Operation<()>, ) { - struct MapOperation<'a, B> { - operation: &'a mut dyn widget::Operation<B>, - } - - impl<'a, T, B> widget::Operation<T> for MapOperation<'a, B> { - fn container( - &mut self, - id: Option<&widget::Id>, - bounds: Rectangle, - operate_on_children: &mut dyn FnMut( - &mut dyn widget::Operation<T>, - ), - ) { - self.operation.container(id, bounds, &mut |operation| { - operate_on_children(&mut MapOperation { operation }); - }); - } - - fn focusable( - &mut self, - state: &mut dyn widget::operation::Focusable, - id: Option<&widget::Id>, - ) { - self.operation.focusable(state, id); - } - - fn scrollable( - &mut self, - state: &mut dyn widget::operation::Scrollable, - id: Option<&widget::Id>, - bounds: Rectangle, - translation: Vector, - ) { - self.operation.scrollable(state, id, bounds, translation); - } - - fn text_input( - &mut self, - state: &mut dyn widget::operation::TextInput, - id: Option<&widget::Id>, - ) { - self.operation.text_input(state, id); - } - - fn custom(&mut self, state: &mut dyn Any, id: Option<&widget::Id>) { - self.operation.custom(state, id); - } - } - - self.widget.operate( - tree, - layout, - renderer, - &mut MapOperation { operation }, - ); + self.widget.operate(tree, layout, renderer, operation); } fn on_event( @@ -495,7 +440,7 @@ where state: &mut Tree, layout: Layout<'_>, renderer: &Renderer, - operation: &mut dyn widget::Operation<Message>, + operation: &mut dyn widget::Operation<()>, ) { self.element .widget |