diff --git a/futures-util/src/stream/iter.rs b/futures-util/src/stream/iter.rs index 20471c2ed..48b6519a3 100644 --- a/futures-util/src/stream/iter.rs +++ b/futures-util/src/stream/iter.rs @@ -10,6 +10,23 @@ pub struct Iter { iter: I, } +impl Iter { + /// Acquires a reference to the underlying iterator that this stream is pulling from. + pub fn get_ref(&self) -> &I { + &self.iter + } + + /// Acquires a mutable reference to the underlying iterator that this stream is pulling from. + pub fn get_mut(&mut self) -> &mut I { + &mut self.iter + } + + /// Consumes this stream, returning the underlying iterator. + pub fn into_inner(self) -> I { + self.iter + } +} + impl Unpin for Iter {} /// Converts an `Iterator` into a `Stream` which is always ready