-
Notifications
You must be signed in to change notification settings - Fork 984
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 Swarm::next_extended #1374
Add Swarm::next_extended #1374
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a naming suggestion.
swarm/src/lib.rs
Outdated
/// Internal function used by everything event-related. | ||
/// | ||
/// Polls the `Swarm` for the next event. | ||
fn poll_next_extended(mut self: Pin<&mut Self>, cx: &mut Context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn poll_next_extended(mut self: Pin<&mut Self>, cx: &mut Context) | |
fn poll_next_event(mut self: Pin<&mut Self>, cx: &mut Context) |
swarm/src/lib.rs
Outdated
/// Returns the next event that happens in the `Swarm`. | ||
/// | ||
/// Includes events from the `NetworkBehaviour` but also events about the connections status. | ||
pub async fn next_extended(&mut self) -> SwarmEvent<TBehaviour::OutEvent> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub async fn next_extended(&mut self) -> SwarmEvent<TBehaviour::OutEvent> { | |
pub async fn next_event(&mut self) -> SwarmEvent<TBehaviour::OutEvent> { |
This PR is against
stable-futures
.It fixes the situation with the
identify
test by adding aSwarmEvent
struct containing more events such as "new listener address".The
Swarm
now has two new async methods:next()
andnext_extended()
. The former is the same as callingStream::next()
except thatNone
is never returned. The latter is the same asnext()
except that it returns aSwarmEvent
.Additionally, polling the
Swarm
no longer returns aResult
.We can either merge before or after #1328, but this change should be in the CHANGELOG.