diff options
author | 2020-01-16 07:01:25 +0100 | |
---|---|---|
committer | 2020-01-16 07:01:25 +0100 | |
commit | 5de404ddd9484c6e1113697d749524ac79d8c763 (patch) | |
tree | 8d0137c09d38e1f2f7db4cfef16ae6beaeb2d3e7 | |
parent | a508b007d8c00e16aaf44b1968b89cf0908c3a51 (diff) | |
download | iced-5de404ddd9484c6e1113697d749524ac79d8c763.tar.gz iced-5de404ddd9484c6e1113697d749524ac79d8c763.tar.bz2 iced-5de404ddd9484c6e1113697d749524ac79d8c763.zip |
Take `IntoIterator` instead of `Iterator`
-rw-r--r-- | core/src/command.rs | 7 | ||||
-rw-r--r-- | core/src/subscription.rs | 3 | ||||
-rw-r--r-- | native/src/user_interface.rs | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/core/src/command.rs b/core/src/command.rs index 1172976f..e7885fb8 100644 --- a/core/src/command.rs +++ b/core/src/command.rs @@ -65,9 +65,12 @@ impl<T> Command<T> { /// Once this command is run, all the commands will be exectued at once. /// /// [`Command`]: struct.Command.html - pub fn batch(commands: impl Iterator<Item = Command<T>>) -> Self { + pub fn batch(commands: impl IntoIterator<Item = Command<T>>) -> Self { Self { - futures: commands.flat_map(|command| command.futures).collect(), + futures: commands + .into_iter() + .flat_map(|command| command.futures) + .collect(), } } diff --git a/core/src/subscription.rs b/core/src/subscription.rs index 8de6cae8..d9e7e388 100644 --- a/core/src/subscription.rs +++ b/core/src/subscription.rs @@ -50,10 +50,11 @@ where /// /// [`Subscription`]: struct.Subscription.html pub fn batch( - subscriptions: impl Iterator<Item = Subscription<H, I, O>>, + subscriptions: impl IntoIterator<Item = Subscription<H, I, O>>, ) -> Self { Self { recipes: subscriptions + .into_iter() .flat_map(|subscription| subscription.recipes) .collect(), } diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 85b25bc7..53b36240 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -176,7 +176,7 @@ where &mut self, renderer: &Renderer, clipboard: Option<&dyn Clipboard>, - events: impl Iterator<Item = Event>, + events: impl IntoIterator<Item = Event>, ) -> Vec<Message> { let mut messages = Vec::new(); |