quinn-rs / quinn

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

Expose RecvStream::poll_read & poll_read_chunk #1784

Closed jean-airoldie closed 6 months ago

jean-airoldie commented 6 months ago

Closes #1782

jean-airoldie commented 6 months ago

Now for this one, the poll_read_chunk is not part of AsyncRead, so technically this would force you to support that new method, but I figured that if it might result in improved read performance, that might be desirable to expose too.

jean-airoldie commented 6 months ago

In my use case, I'm thinking of using poll_read to read the size prefix, followed by poll_read_chunk to read the actual message, for instance.

jean-airoldie commented 6 months ago

This is speculative. I'd prefer to avoid further complicating our API without a concrete use case that benefits, particularly as using poll_read_buf correctly is itself complex.

Fair enough. In my understanding, the potential benefit was from the unordered read, even if you have to copy the chunks into a separate buffer, in the same way the read_to_end method is implemented.

djc commented 6 months ago

(Needs a rebase. Would be nice if you can squash the commits here.)