1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-18 05:37:52 +02:00

Rephrase awkward sentence in rc.md (#906)

This commit is contained in:
Martin Geisler 2023-07-06 15:03:06 +02:00 committed by GitHub
parent 0c408f139c
commit e199aee30d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,7 @@ fn main() {
<details>
* `Rc`'s count ensures that its contained value is valid for as long as there are references.
* Like C++'s `std::shared_ptr`.
* `Rc` in Rust is like `std::shared_ptr` in C++.
* `Rc::clone` is cheap: it creates a pointer to the same allocation and increases the reference count. Does not make a deep clone and can generally be ignored when looking for performance issues in code.
* `make_mut` actually clones the inner value if necessary ("clone-on-write") and returns a mutable reference.
* Use `Rc::strong_count` to check the reference count.