Cloning the stream is the current approach being explored. See 
https://github.com/mozilla/rust/pull/11894.

-Kevin

On Jan 29, 2014, at 2:17 PM, Tony Arcieri <[email protected]> wrote:

> On Wed, Jan 29, 2014 at 2:11 PM, Kevin Ballard <[email protected]> wrote:
> This solution will not work for what I need stream splitting for. Namely, I 
> need to be in the middle of reading from a socket when I decide that I need 
> to write. I cannot be waiting on the read future at that time or I won't be 
> able to start writing. And if I don't wait on the read future, I won't know 
> when I have data available.
> 
> I initially thought splitting streams was a good solution, but simultaneous 
> writes from multiple tasks (if you use a protocol with self-delimiting 
> frames) seems like a valid use case that is probably best addressed by 
> cloning streams rather than splitting them.
> 
> Cloning streams would allow both that use case and reduce the total number of 
> types, as splitting would result in a "type explosion" (e.g. TcpStream, 
> TcpReader, TcpWriter)
> 
> -- 
> Tony Arcieri

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to