[rust-dev] Futures in Rust

Tony Arcieri bascule at gmail.com
Wed Jan 29 14:17:04 PST 2014

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/86d32da0/attachment.html>

More information about the Rust-dev mailing list