quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

next() method not found in Incoming #1262

Closed euberdeveloper closed 2 years ago

euberdeveloper commented 2 years ago

Part of my code in the server is:

let (endpoint, mut incoming) = quinn::Endpoint::server(server_config, listen_address)?;
println!("listening on {}", endpoint.local_addr()?);

while let Some(conn) = incoming.next().await {
        // my code
}

I have this compile error when I call .next():

no method named `next` found for struct `quinn::Incoming` in the current scope

Is it anything with the version 0.8.0 of Quinn?

euberdeveloper commented 2 years ago

Sorry for the mistake, I am new to rust

I just had to use use futures_util::stream::stream::StreamExt; because the implementation of the trait with next for Incoming was not on scope

Ralith commented 2 years ago

That's correct; no worries! I've actually been thinking of adding an inherent version, to avoid the mandatory (surprisingly heavy) futures_util dep.

wmmc88 commented 2 years ago

That's correct; no worries! I've actually been thinking of adding an inherent version, to avoid the mandatory (surprisingly heavy) futures_util dep.

I thought #1263 removes the need for use futures_util::stream::stream::StreamExt;, but it seems like its still required? (quinn 0.8.3)

edit: nvm. just saw the change isn't released yet.