If Rust’s core syntax based on story ownership and borrowing But rc is against it. This is against with Rustocean’s thinking. why u put on Rust language. Is it really needed.
We use the
Rc<T>type when we want to allocate some data on the heap for multiple parts of our program to read and we can’t determine at compile time which part will finish using the data last. If we knew which part would finish last, we could just make that part the data’s owner, and the normal ownership rules enforced at compile time would take effect.
The vast majority of the time, clear ownership of data is what you want, and so Rust makes this the default way of dealing with things. But as with any static analysis, there’s edge cases and exceptions to the rule - rather than just disallowing these (and potentially stopping people from writing perfectly valid programs), Rust is pragmatic, and provides an escape hatch.