[rust-dev] Futures in Rust

Kevin Ballard kevin at sb.org
Wed Jan 29 15:54:22 PST 2014


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 <bascule at gmail.com> wrote:

> On Wed, Jan 29, 2014 at 2:11 PM, Kevin Ballard <kevin at sb.org> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140129/9848c9dc/attachment.html>


More information about the Rust-dev mailing list