What happens when an Arc is cloned?

后端 未结 3 865
耶瑟儿~
耶瑟儿~ 2020-12-05 23:58

I am learning concurrency and want to clarify my understanding on the following code example from the Rust book. Please correct me if I am wrong.

use std::         


        
3条回答
  •  北海茫月
    2020-12-06 00:05

    [...] what is happening on let data = data.clone()?

    Arc stands for Atomically Reference Counted. An Arc manages one object (of type T) and serves as a proxy to allow for shared ownership, meaning: one object is owned by multiple names. Wow, that sounds abstract, let's break it down!

    Shared Ownership

    Let's say you have an object of type Turtle

提交回复
热议问题