[rust-dev] RFC: New Rust channel proposal

Lee Braiden leebraid at gmail.com
Fri Jan 24 04:23:03 PST 2014

On 24/01/14 03:54, Brandon Sanderson wrote:
> I would expect Channel::new() to create a channel object that either 
> lets me send and receive, or lets me get a source and sink to send and 
> receive with.  Borrow rules may prevent this, but my point is that 
> Channel::new() would generally be expected to return a struct, and not 
> a tuple.

Yes.  I think either:

     * Channel should be a struct, created by Channel::new(), with 
sender and receiver instances as fields (by whatever name) -- 
essentially, the tuple should become a struct, with better naming of 
port and chan
     * Channel should have a  ChannelTrait implemention, with send() and 
receive(), and should be created by Channel::new()

But from what Benjamin says below, it seems like the latter isn't necessary.

> On Jan 23, 2014 7:29 PM, "Benjamin Striegel" <ben.striegel at gmail.com 
> <mailto:ben.striegel at gmail.com>> wrote:
>     This all seems a bit silly. A channel *is*, conceptually, a tuple
>     of a sender and a receiver. If I call Chan::new(), that's what I
>     expect to get. And Chan::open() doesn't map to anything that's as
>     intuitive.


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

More information about the Rust-dev mailing list