quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.85k stars 394 forks source link

Named futures + replace NewConnection with Connection methods #1357

Closed Ralith closed 2 years ago

Ralith commented 2 years ago

Experimenting with a return to named 'static futures, motivated by downstream use cases. See e.g. https://github.com/hyperium/h3/pull/80.

Open questions:

Also included is an idea to drop NewConnection in favor of unobtrusive async methods on Connection, bundled because they would have to be rewritten to match this PR's approach if it move forwards. I'd like feedback on this change before I invest the effort to actually remove NewConnection and update all the examples/docs.

djc commented 2 years ago

Sorry for the slow review...

Ralith commented 2 years ago

No worries; it's not particularly pressing, nor a rebase hazard.

Ralith commented 2 years ago

Still TODO: Actually getting rid of NewConnection, unless there's a compelling reason to keep it around.

Ralith commented 2 years ago

That seems to have panned out to a pleasant simplification in the tests/examples. Less unwrap, less nesting, and fewer intermediate variables all 'round.