summaryrefslogtreecommitdiffstats
path: root/core/src/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-06-16 20:24:41 +0200
committerLibravatar GitHub <noreply@github.com>2024-06-16 20:24:41 +0200
commit95d4adb55e485c01eec839736f328be26f2ccab6 (patch)
tree2676e3cb8ec17c5bf1cd561d97932ae302551dfd /core/src/widget
parente6d0b3bda5042a1017a5944a5227c97e0ed6caf9 (diff)
parentb5c5a016c4f2b608a740b37c494186557a064f48 (diff)
downloadiced-95d4adb55e485c01eec839736f328be26f2ccab6.tar.gz
iced-95d4adb55e485c01eec839736f328be26f2ccab6.tar.bz2
iced-95d4adb55e485c01eec839736f328be26f2ccab6.zip
Merge pull request #2463 from iced-rs/task-api
`Task` API
Diffstat (limited to 'core/src/widget')
-rw-r--r--core/src/widget/operation.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/src/widget/operation.rs b/core/src/widget/operation.rs
index b91cf9ac..3e4ed618 100644
--- a/core/src/widget/operation.rs
+++ b/core/src/widget/operation.rs
@@ -12,11 +12,11 @@ use crate::{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>: Send {
/// 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),
}
}