summaryrefslogtreecommitdiffstats
path: root/core/src/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-14 01:47:39 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-14 01:47:39 +0200
commita25b1af45690bdd8e1cbb20ee3a5b1c4342de455 (patch)
tree432044cf682dd73d1019a2f964749e78db178865 /core/src/widget
parente6d0b3bda5042a1017a5944a5227c97e0ed6caf9 (diff)
downloadiced-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/widget')
-rw-r--r--core/src/widget/operation.rs12
1 files changed, 6 insertions, 6 deletions
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<T> {
+pub trait Operation<T>: 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<A, B>(
operation: Box<dyn Operation<A>>,
- f: impl Fn(A) -> B + 'static,
+ f: impl Fn(A) -> B + Send + Sync + 'static,
) -> impl Operation<B>
where
A: 'static,
@@ -90,7 +90,7 @@ where
#[allow(missing_debug_implementations)]
struct Map<A, B> {
operation: Box<dyn Operation<A>>,
- f: Rc<dyn Fn(A) -> B>,
+ f: Arc<dyn Fn(A) -> B + Send + Sync>,
}
impl<A, B> Operation<B> for Map<A, B>
@@ -197,7 +197,7 @@ where
Map {
operation,
- f: Rc::new(f),
+ f: Arc::new(f),
}
}