Skip to content

Instantly share code, notes, and snippets.

@bltavares
Last active February 8, 2020 16:32
Show Gist options
  • Save bltavares/7fd1d4babf5c40f515dc41697ee64a72 to your computer and use it in GitHub Desktop.
Save bltavares/7fd1d4babf5c40f515dc41697ee64a72 to your computer and use it in GitHub Desktop.
pub fn with_discovery(&mut self, mechanisms: Vec<impl Stream<Item = SocketAddr>>) {
let stream = mechanisms
.into_iter()
.fold(stream::pending(), |init, item| init.merge(item));
/// mismatched types
/// expected struct `async_std::stream::pending::Pending<_>`
/// found struct `async_std::stream::stream::merge::Merge<async_std::stream::pending::Pending<_>, impl Stream<Item = SocketAddr>>`
}
pub fn with_discovery_iter(&mut self, mechanisms: Vec<impl Stream<Item = SocketAddr>>) {
let stream = stream::pending();
for item in mechanisms {
stream = stream.merge(item);
/// mismatched types
/// expected struct `async_std::stream::pending::Pending<_>`
/// found struct `async_std::stream::stream::merge::Merge<async_std::stream::pending::Pending<_>, impl Stream<Item = SocketAddr>>`
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment