futures_time/stream/
into_stream.rs

1use futures_core::Stream;
2
3/// Conversion into a `Stream`.
4///
5/// By implementing `IntoIterator` for a type, you define how it will be
6/// converted to an iterator. This is common for types which describe a
7/// collection of some kind.
8pub trait IntoStream {
9    /// The type of the elements being iterated over.
10    type Item;
11
12    /// Which kind of stream are we turning this into?
13    type IntoStream: Stream<Item = Self::Item>;
14
15    /// Creates a stream from a value.
16    fn into_stream(self) -> Self::IntoStream;
17}
18
19impl<I: Stream> IntoStream for I {
20    type Item = I::Item;
21    type IntoStream = I;
22
23    #[inline]
24    fn into_stream(self) -> I {
25        self
26    }
27}