Take IntoIterator instead of Iterator

This commit is contained in:
Héctor Ramón Jiménez 2020-01-16 07:01:25 +01:00
parent a508b007d8
commit 5de404ddd9
3 changed files with 8 additions and 4 deletions

View file

@ -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(),
}
}