tokio icon indicating copy to clipboard operation
tokio copied to clipboard

Making the Stream adaptor structures public in tokio-stream

Open sharpened-nacho opened this issue 1 year ago • 2 comments

Motivation

The StreamExt trait provides the helpful method take, map, and the like on Streams. But the structures themselves (Take, Map, etc.) are not visible outside the crate, as they are not pub use in stream_ext.rs.

Solution

Re-exported publicly all the structures in stream_ext.rs except for Collect, which is different and should not be exported as stated in its documentation. Re-exported them publicly again in lib.rs.

Added a function in a test with return type Chain to show that it can be part of an external function signature.

Closes: #6656

sharpened-nacho avatar Jun 25 '24 10:06 sharpened-nacho

My bad again, sorry for pushing bad commits like those, I'm not familiar enough with large projects to understand how to run all tests. I hope you can squash all that mess together...

sharpened-nacho avatar Jun 25 '24 12:06 sharpened-nacho

I just realized the equivalence between tokio_stream::StreamExt and futures_util::StreamExt. But in futures-util the structures are exported and accessible, so the functionality I needed is ultimately not needed here, I can get it from futures-util. Do you want to roll back to the beginning and drop this PR?

sharpened-nacho avatar Jun 25 '24 13:06 sharpened-nacho

Any idea when a new version of tokio-stream will be rolled with this in it? Thanks!

devanoneth avatar Jul 03 '24 20:07 devanoneth

I don't have concrete plans for a release right now.

Darksonn avatar Jul 14 '24 17:07 Darksonn

Releasing in #6825.

djc avatar Sep 05 '24 09:09 djc