summaryrefslogtreecommitdiffstats
path: root/core/src/widget
diff options
context:
space:
mode:
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),
}
}