summaryrefslogtreecommitdiffstats
path: root/futures
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 /futures
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 'futures')
-rw-r--r--futures/src/event.rs2
-rw-r--r--futures/src/executor.rs2
-rw-r--r--futures/src/keyboard.rs2
-rw-r--r--futures/src/lib.rs2
-rw-r--r--futures/src/maybe.rs35
-rw-r--r--futures/src/runtime.rs3
-rw-r--r--futures/src/subscription.rs3
-rw-r--r--futures/src/subscription/tracker.rs3
8 files changed, 9 insertions, 43 deletions
diff --git a/futures/src/event.rs b/futures/src/event.rs
index 72ea78ad..ab895fcd 100644
--- a/futures/src/event.rs
+++ b/futures/src/event.rs
@@ -1,8 +1,8 @@
//! Listen to runtime events.
use crate::core::event::{self, Event};
use crate::core::window;
+use crate::core::MaybeSend;
use crate::subscription::{self, Subscription};
-use crate::MaybeSend;
/// Returns a [`Subscription`] to all the ignored runtime events.
///
diff --git a/futures/src/executor.rs b/futures/src/executor.rs
index 5ac76081..a9dde465 100644
--- a/futures/src/executor.rs
+++ b/futures/src/executor.rs
@@ -1,5 +1,5 @@
//! Choose your preferred executor to power a runtime.
-use crate::MaybeSend;
+use crate::core::MaybeSend;
use futures::Future;
/// A type that can run futures.
diff --git a/futures/src/keyboard.rs b/futures/src/keyboard.rs
index f0d7d757..c86e2169 100644
--- a/futures/src/keyboard.rs
+++ b/futures/src/keyboard.rs
@@ -2,8 +2,8 @@
use crate::core;
use crate::core::event;
use crate::core::keyboard::{Event, Key, Modifiers};
+use crate::core::MaybeSend;
use crate::subscription::{self, Subscription};
-use crate::MaybeSend;
/// Listens to keyboard key presses and calls the given function
/// map them into actual messages.
diff --git a/futures/src/lib.rs b/futures/src/lib.rs
index a874a618..01b56306 100644
--- a/futures/src/lib.rs
+++ b/futures/src/lib.rs
@@ -8,7 +8,6 @@
pub use futures;
pub use iced_core as core;
-mod maybe;
mod runtime;
pub mod backend;
@@ -18,7 +17,6 @@ pub mod keyboard;
pub mod subscription;
pub use executor::Executor;
-pub use maybe::{MaybeSend, MaybeSync};
pub use platform::*;
pub use runtime::Runtime;
pub use subscription::Subscription;
diff --git a/futures/src/maybe.rs b/futures/src/maybe.rs
deleted file mode 100644
index c6a507c1..00000000
--- a/futures/src/maybe.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#[cfg(not(target_arch = "wasm32"))]
-mod platform {
- /// An extension trait that enforces `Send` only on native platforms.
- ///
- /// Useful for writing cross-platform async code!
- pub trait MaybeSend: Send {}
-
- impl<T> MaybeSend for T where T: Send {}
-
- /// An extension trait that enforces `Sync` only on native platforms.
- ///
- /// Useful for writing cross-platform async code!
- pub trait MaybeSync: Sync {}
-
- impl<T> MaybeSync for T where T: Sync {}
-}
-
-#[cfg(target_arch = "wasm32")]
-mod platform {
- /// An extension trait that enforces `Send` only on native platforms.
- ///
- /// Useful for writing cross-platform async code!
- pub trait MaybeSend {}
-
- impl<T> MaybeSend for T {}
-
- /// An extension trait that enforces `Sync` only on native platforms.
- ///
- /// Useful for writing cross-platform async code!
- pub trait MaybeSync {}
-
- impl<T> MaybeSync for T {}
-}
-
-pub use platform::{MaybeSend, MaybeSync};
diff --git a/futures/src/runtime.rs b/futures/src/runtime.rs
index 157e2c67..045fde6c 100644
--- a/futures/src/runtime.rs
+++ b/futures/src/runtime.rs
@@ -1,6 +1,7 @@
//! Run commands and keep track of subscriptions.
+use crate::core::MaybeSend;
use crate::subscription;
-use crate::{BoxFuture, BoxStream, Executor, MaybeSend};
+use crate::{BoxFuture, BoxStream, Executor};
use futures::{channel::mpsc, Sink};
use std::marker::PhantomData;
diff --git a/futures/src/subscription.rs b/futures/src/subscription.rs
index 316fc44d..85a8a787 100644
--- a/futures/src/subscription.rs
+++ b/futures/src/subscription.rs
@@ -5,8 +5,9 @@ pub use tracker::Tracker;
use crate::core::event;
use crate::core::window;
+use crate::core::MaybeSend;
use crate::futures::{Future, Stream};
-use crate::{BoxStream, MaybeSend};
+use crate::BoxStream;
use futures::channel::mpsc;
use futures::never::Never;
diff --git a/futures/src/subscription/tracker.rs b/futures/src/subscription/tracker.rs
index f17e3ea3..c5a7bb99 100644
--- a/futures/src/subscription/tracker.rs
+++ b/futures/src/subscription/tracker.rs
@@ -1,5 +1,6 @@
+use crate::core::MaybeSend;
use crate::subscription::{Event, Hasher, Recipe};
-use crate::{BoxFuture, MaybeSend};
+use crate::BoxFuture;
use futures::channel::mpsc;
use futures::sink::{Sink, SinkExt};