Skip to content

Commit c1ff07c

Browse files
wfrasertaiki-e
authored andcommitted
Add accessors for the inner of stream::Iter (#2875)
1 parent 85b0038 commit c1ff07c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

futures-util/src/stream/iter.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ pub struct Iter<I> {
1010
iter: I,
1111
}
1212

13+
impl<I> Iter<I> {
14+
/// Acquires a reference to the underlying iterator that this stream is pulling from.
15+
pub fn get_ref(&self) -> &I {
16+
&self.iter
17+
}
18+
19+
/// Acquires a mutable reference to the underlying iterator that this stream is pulling from.
20+
pub fn get_mut(&mut self) -> &mut I {
21+
&mut self.iter
22+
}
23+
24+
/// Consumes this stream, returning the underlying iterator.
25+
pub fn into_inner(self) -> I {
26+
self.iter
27+
}
28+
}
29+
1330
impl<I> Unpin for Iter<I> {}
1431

1532
/// Converts an `Iterator` into a `Stream` which is always ready

0 commit comments

Comments
 (0)