swarm/src/handler: Add impl IntoIterator for MultiHandler (#2572)

This commit is contained in:
Roman
2022-03-21 20:50:44 +03:00
committed by GitHub
parent 6b5744c33d
commit d81ad52ff8
2 changed files with 12 additions and 0 deletions

View File

@ -319,6 +319,16 @@ where
}
}
/// Split [`MultiHandler`] into parts.
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> {