Unfortunately, my value is not Owned but Shared. So, what is the cheapest way 
for making conversion between Owned -> Shared and Shared -> Owned?

On Apr 19, 2013, at 7:31 PM, Daniel Micay <[email protected]> wrote:

> On Fri, Apr 19, 2013 at 10:44 AM, Alexander Stavonin
> <[email protected]> wrote:
>> Do we have any possibility to do something like this or only owned values
>> can be send?
>> 
>> 11 fn task_with_shared_pointers() {
>> 12     let value = @[1, 2, 3, 4, 5];
>> 13     let (server_chan, server_port) = stream();
>> 14
>> 15     do task::spawn {
>> 16         let val: @[uint] = server_chan.recv();
>> 17         io::println(fmt!("Value: %?", val));
>> 18     }
>> 19     server_port.send(copy value);
>> 20 }
> 
> If you have @T where T is Owned, you have to explicitly copy the inner
> part with (*foo).clone() and send that.

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to