async_iterator/into_iterator.rs
1use crate::Iterator;
2
3/// Conversion into an [`Iterator`].
4pub trait IntoIterator {
5 /// The type of the elements being iterated over.
6 type Item;
7
8 /// Which kind of iterator are we turning this into?
9 type IntoIter: Iterator<Item = Self::Item>;
10
11 /// Creates an iterator from a value.
12 async fn into_iter(self) -> Self::IntoIter;
13}
14
15impl<I: Iterator> IntoIterator for I {
16 type Item = I::Item;
17 type IntoIter = I;
18
19 async fn into_iter(self) -> I {
20 self
21 }
22}