Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add impl IntoIterator for MultiHandler to get access to inners #2572

Merged
merged 4 commits into from Mar 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions swarm/src/handler/multi.rs
Expand Up @@ -319,6 +319,16 @@ where
}
}

/// Split `MultiHandler` into parts.
kpp marked this conversation as resolved.
Show resolved Hide resolved
impl<K, H> IntoIterator for MultiHandler<K, H> {
type Item = <Self::IntoIter as Iterator>::Item;
type IntoIter = std::collections::hash_map::IntoIter<K, H>;

fn into_iter(self) -> Self::IntoIter {
self.handlers.into_iter()
}
}

/// A [`IntoConnectionHandler`] for multiple other `IntoConnectionHandler`s.
#[derive(Clone)]
pub struct IntoMultiHandler<K, H> {
Expand Down