summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-28 21:45:30 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-28 21:51:13 +0700
commit90afd1db8df17a7afa06b521ccd52455eced9277 (patch)
tree6d72f34e4e2953d8d02e18b209b8246e9c32e262 /native
parente730d97f61bc2edc77d2f061b6a763c4d0a948df (diff)
downloadiced-90afd1db8df17a7afa06b521ccd52455eced9277.tar.gz
iced-90afd1db8df17a7afa06b521ccd52455eced9277.tar.bz2
iced-90afd1db8df17a7afa06b521ccd52455eced9277.zip
Use `MaybeSend` in `perform` and `map` for `Command`
Diffstat (limited to 'native')
-rw-r--r--native/src/clipboard.rs7
-rw-r--r--native/src/command.rs8
-rw-r--r--native/src/command/action.rs7
3 files changed, 17 insertions, 5 deletions
diff --git a/native/src/clipboard.rs b/native/src/clipboard.rs
index 60703c31..c9105bc0 100644
--- a/native/src/clipboard.rs
+++ b/native/src/clipboard.rs
@@ -1,4 +1,6 @@
//! Access the clipboard.
+use iced_futures::MaybeSend;
+
use std::fmt;
/// A buffer for short-term storage and transfer within and between
@@ -36,7 +38,10 @@ pub enum Action<T> {
impl<T> Action<T> {
/// Maps the output of a clipboard [`Action`] using the provided closure.
- pub fn map<A>(self, f: impl Fn(T) -> A + 'static + Send + Sync) -> Action<A>
+ pub fn map<A>(
+ self,
+ f: impl Fn(T) -> A + 'static + MaybeSend + Sync,
+ ) -> Action<A>
where
T: 'static,
{
diff --git a/native/src/command.rs b/native/src/command.rs
index 6fe518d7..89d0f045 100644
--- a/native/src/command.rs
+++ b/native/src/command.rs
@@ -3,6 +3,8 @@ mod action;
pub use action::Action;
+use iced_futures::MaybeSend;
+
use std::fmt;
use std::future::Future;
@@ -24,8 +26,8 @@ impl<T> Command<T> {
/// Creates a [`Command`] that performs the action of the given future.
pub fn perform<A>(
- future: impl Future<Output = T> + 'static + Send,
- f: impl Fn(T) -> A + 'static + Send,
+ future: impl Future<Output = T> + 'static + MaybeSend,
+ f: impl Fn(T) -> A + 'static + MaybeSend,
) -> Command<A> {
use iced_futures::futures::FutureExt;
@@ -45,7 +47,7 @@ impl<T> Command<T> {
/// Applies a transformation to the result of a [`Command`].
pub fn map<A>(
self,
- f: impl Fn(T) -> A + 'static + Send + Sync + Clone,
+ f: impl Fn(T) -> A + 'static + MaybeSend + Sync + Clone,
) -> Command<A>
where
T: 'static,
diff --git a/native/src/command/action.rs b/native/src/command/action.rs
index 77be1b59..5c7509c8 100644
--- a/native/src/command/action.rs
+++ b/native/src/command/action.rs
@@ -1,6 +1,8 @@
use crate::clipboard;
use crate::window;
+use iced_futures::MaybeSend;
+
use std::fmt;
/// An action that a [`Command`] can perform.
@@ -19,7 +21,10 @@ pub enum Action<T> {
impl<T> Action<T> {
/// Applies a transformation to the result of a [`Command`].
- pub fn map<A>(self, f: impl Fn(T) -> A + 'static + Send + Sync) -> Action<A>
+ pub fn map<A>(
+ self,
+ f: impl Fn(T) -> A + 'static + MaybeSend + Sync,
+ ) -> Action<A>
where
T: 'static,
{