Make a second pipestream inside the async task and send the new chan object through the chan object that was passed into the task. You'll have a port inside the task that can listen to the newly created chan object. On Jul 9, 2013 1:42 AM, "Alexander Stavonin" <[email protected]> wrote:
> Brian, thank you for explanation. But, in that case I have one more > question. If PipeBytePort is unsendable any more, how bidirectional, > pipe_stream > based communication could be organised? > > > Best regards, > Alexander. > > 2013/7/8 <[email protected]> >> >> >> Message: 1 >> Date: Mon, 08 Jul 2013 11:24:42 -0700 >> From: Brian Anderson <[email protected]> >> To: [email protected] >> Subject: Re: [rust-dev] flatpipes question >> Message-ID: <[email protected]> >> Content-Type: text/plain; charset=ISO-8859-1; format=flowed >> >> On 07/08/2013 06:43 AM, Josh Leverette wrote: >> > >> > extern mod std; >> > extern mod extra; >> > use std::{task, io}; >> > use extra::flatpipes; >> > >> > fn main() { >> > let (port, chan) = flatpipes::serial::pipe_stream(); >> > let portBox = ~port; >> > do task::spawn || { >> > let val = portBox.recv(); >> > io::println(fmt!("Value: %?", val)); >> > } >> > let value = @[1, 2, 3, 4, 5]; >> > chan.send(value); >> > } >> >> The problem is that an @-box was added to the PipeBytePort type, which >> makes it unsendable, so at the moment flatpipe ports cannot be sent. >> Channels are still sendable. Here's the definition in question: >> >> pub struct PipeBytePort { >> port: comm::Port<~[u8]>, >> buf: @mut ~[u8] >> } >> >> _______________________________________________ >> Rust-dev mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/rust-dev >> >> >> End of Rust-dev Digest, Vol 37, Issue 25 >> **************************************** >> > > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
