Skip to content

Commit 19561e9

Browse files
committed
Expose FuturesUnorderedIter*Mut
1 parent 64eb779 commit 19561e9

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

futures-util/src/stream/futures_unordered/iter.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ use core::pin::Pin;
55

66
#[derive(Debug)]
77
/// Mutable iterator over all futures in the unordered set.
8-
pub struct IterPinMut<'a, Fut> {
8+
pub struct FuturesUnorderedIterPinMut<'a, Fut> {
99
pub(super) task: *const Task<Fut>,
1010
pub(super) len: usize,
1111
pub(super) _marker: PhantomData<&'a mut FuturesUnordered<Fut>>
1212
}
1313

1414
#[derive(Debug)]
1515
/// Mutable iterator over all futures in the unordered set.
16-
pub struct IterMut<'a, Fut: Unpin> (pub(super) IterPinMut<'a, Fut>);
16+
pub struct FuturesUnorderedIterMut<'a, Fut: Unpin> (pub(super) FuturesUnorderedIterPinMut<'a, Fut>);
1717

18-
impl<'a, Fut> Iterator for IterPinMut<'a, Fut> {
18+
impl<'a, Fut> Iterator for FuturesUnorderedIterPinMut<'a, Fut> {
1919
type Item = Pin<&'a mut Fut>;
2020

2121
fn next(&mut self) -> Option<Pin<&'a mut Fut>> {
@@ -36,9 +36,9 @@ impl<'a, Fut> Iterator for IterPinMut<'a, Fut> {
3636
}
3737
}
3838

39-
impl<Fut> ExactSizeIterator for IterPinMut<'_, Fut> {}
39+
impl<Fut> ExactSizeIterator for FuturesUnorderedIterPinMut<'_, Fut> {}
4040

41-
impl<'a, Fut: Unpin> Iterator for IterMut<'a, Fut> {
41+
impl<'a, Fut: Unpin> Iterator for FuturesUnorderedIterMut<'a, Fut> {
4242
type Item = &'a mut Fut;
4343

4444
fn next(&mut self) -> Option<&'a mut Fut> {
@@ -50,4 +50,4 @@ impl<'a, Fut: Unpin> Iterator for IterMut<'a, Fut> {
5050
}
5151
}
5252

53-
impl<Fut: Unpin> ExactSizeIterator for IterMut<'_, Fut> {}
53+
impl<Fut: Unpin> ExactSizeIterator for FuturesUnorderedIterMut<'_, Fut> {}

futures-util/src/stream/futures_unordered/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use alloc::sync::{Arc, Weak};
1919
mod abort;
2020

2121
mod iter;
22-
use self::iter::{IterMut, IterPinMut};
22+
pub use self::iter::{FuturesUnorderedIterMut, FuturesUnorderedIterPinMut};
2323

2424
mod task;
2525
use self::task::Task;
@@ -190,14 +190,14 @@ impl<Fut> FuturesUnordered<Fut> {
190190
}
191191

192192
/// Returns an iterator that allows modifying each future in the set.
193-
pub fn iter_mut(&mut self) -> IterMut<'_, Fut> where Fut: Unpin {
194-
IterMut(Pin::new(self).iter_pin_mut())
193+
pub fn iter_mut(&mut self) -> FuturesUnorderedIterMut<'_, Fut> where Fut: Unpin {
194+
FuturesUnorderedIterMut(Pin::new(self).iter_pin_mut())
195195
}
196196

197197
/// Returns an iterator that allows modifying each future in the set.
198198
#[allow(clippy::needless_lifetimes)] // https://github.com/rust-lang/rust/issues/52675
199-
pub fn iter_pin_mut<'a>(self: Pin<&'a mut Self>) -> IterPinMut<'a, Fut> {
200-
IterPinMut {
199+
pub fn iter_pin_mut<'a>(self: Pin<&'a mut Self>) -> FuturesUnorderedIterPinMut<'a, Fut> {
200+
FuturesUnorderedIterPinMut {
201201
task: self.head_all,
202202
len: self.len(),
203203
_marker: PhantomData

futures-util/src/stream/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ cfg_target_has_atomic! {
128128
#[cfg(feature = "alloc")]
129129
mod futures_unordered;
130130
#[cfg(feature = "alloc")]
131-
pub use self::futures_unordered::{futures_unordered, FuturesUnordered};
131+
#[doc(inline)]
132+
pub use self::futures_unordered::{
133+
futures_unordered, FuturesUnordered, FuturesUnorderedIterMut,
134+
FuturesUnorderedIterPinMut,
135+
};
132136

133137
#[cfg(feature = "alloc")]
134138
mod split;

0 commit comments

Comments
 (0)