Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
StoicDeveloper committed Jun 11, 2023
1 parent 85da253 commit 98b2819
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions futures-util/src/stream/mapped_futures/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ pub struct IntoIter<K: Hash + Eq, Fut: Unpin> {
pub(super) inner: MappedFutures<K, Fut>,
}

/// Immutable iterator over all keys in the mapping.
#[derive(Debug)]
pub struct Keys<'a, K: Hash + Eq, Fut> {
pub(super) inner: std::iter::Map<
std::collections::hash_set::Iter<'a, HashTask<K, Fut>>,
Box<dyn FnMut(&'a HashTask<K, Fut>) -> &'a K>,
>,
}

impl<K: Hash + Eq, Fut: Unpin> Iterator for IntoIter<K, Fut> {
type Item = Fut;

Expand Down Expand Up @@ -161,12 +170,6 @@ impl<'a, K: Hash + Eq, Fut: Unpin> Iterator for Iter<'a, K, Fut> {

impl<K: Hash + Eq, Fut: Unpin> ExactSizeIterator for Iter<'_, K, Fut> {}

pub struct Keys<'a, K: Hash + Eq, Fut> {
pub(super) inner: std::iter::Map<
std::collections::hash_set::Iter<'a, HashTask<K, Fut>>,
Box<dyn FnMut(&'a HashTask<K, Fut>) -> &'a K>,
>,
}
impl<K: Hash + Eq, Fut: Unpin> ExactSizeIterator for Keys<'_, K, Fut> {}

impl<'a, K: Hash + Eq, Fut> Iterator for Keys<'a, K, Fut> {
Expand Down
1 change: 1 addition & 0 deletions futures-util/src/stream/mapped_futures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ impl<K: Hash + Eq, Fut> MappedFutures<K, Fut> {
None
}

/// Returns an iterator of keys in the mapping.
pub fn keys<'a>(&'a self) -> Keys<'a, K, Fut> {
Keys {
inner: self.hash_set.iter().map(Box::new(|hash_task| HashTask::key_unwrap(hash_task))),
Expand Down

0 comments on commit 98b2819

Please sign in to comment.