I'm trying to understand the idea of DuplexStream. First of all, it can't be 
used for cross-task communications:

 13     let value = gen_data();
 14     let (server, client) = DuplexStream();
 15 
 16     do task::spawn {
 17         let val: ~[uint] = server.recv();
 18         io::println(fmt!("Value: %?", val));
 19         let res = val.map(|v| {v+1});
 20         client.send(res)
 21     }
 22 
 23     server.send(value);                                                     
                                                            
 24     io::println(fmt!("Resilt: %?", client.recv()));

because of error: "21:5 note: `server` moved into closure environment here 
because its type is moved by default".

In library sources I found example which passes messages inside one task, what 
IMHO is not too useful.
Would you please provide a brief explanation of DuplexStream usage scenario?
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to