From a25b1af45690bdd8e1cbb20ee3a5b1c4342de455 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 14 Jun 2024 01:47:39 +0200 Subject: Replace `Command` with a new `Task` API with chain support --- core/src/widget/operation.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/src/widget') diff --git a/core/src/widget/operation.rs b/core/src/widget/operation.rs index b91cf9ac..1fa924a4 100644 --- a/core/src/widget/operation.rs +++ b/core/src/widget/operation.rs @@ -8,15 +8,15 @@ pub use scrollable::Scrollable; pub use text_input::TextInput; use crate::widget::Id; -use crate::{Rectangle, Vector}; +use crate::{MaybeSend, Rectangle, Vector}; use std::any::Any; use std::fmt; -use std::rc::Rc; +use std::sync::Arc; /// A piece of logic that can traverse the widget tree of an application in /// order to query or update some widget state. -pub trait Operation { +pub trait Operation: MaybeSend { /// Operates on a widget that contains other widgets. /// /// The `operate_on_children` function can be called to return control to @@ -81,7 +81,7 @@ where /// Maps the output of an [`Operation`] using the given function. pub fn map( operation: Box>, - f: impl Fn(A) -> B + 'static, + f: impl Fn(A) -> B + Send + Sync + 'static, ) -> impl Operation where A: 'static, @@ -90,7 +90,7 @@ where #[allow(missing_debug_implementations)] struct Map { operation: Box>, - f: Rc B>, + f: Arc B + Send + Sync>, } impl Operation for Map @@ -197,7 +197,7 @@ where Map { operation, - f: Rc::new(f), + f: Arc::new(f), } } -- cgit