Add public split associated function to SimplexStream
#7177
Labels
A-tokio
Area: The main tokio crate
C-feature-request
Category: A feature request.
M-io
Module: tokio/io
Currently the
simplex
function returns a(ReadHalf<SimplexStream>, WriteHalf<SimplexStream>)
which does not conform to the usual convention of(tx, rx)
used across the project which can be confusing - see #7175 fixed in #7176.There are two routes I think we should consider, but I would be very interested in getting some additional input before I submit a PR:
Adding another public method potentially
SimplexStream::new_split
that would return( WriteHalf<SimplexStream>), ReadHalf<SimplexStream>)
to better conform to the convention.Add an extension trait (maybe
SplitEx
?) that would have a blanket implementation forT: AsyncRead + AsyncWrite
which could enable an API such astokio::io::simplex(64).split()
forsimplex
and other resources across the project.Personally I think the first option seems the cleanest and would allow us to then optionally deprecate
simplex
in a future release and have the public API forSimplexStream
feel more familiar.The text was updated successfully, but these errors were encountered: