4 ms·
Note that Rust's "Cow" type is NOT an analogue of copy-on-write C++ strings. The correct analogue in Rust are the Rc and Arc types, and the "make_mut" method t
by devit 7y ago
Note that Rust's "Cow" type is NOT an analogue of copy-on-write C++ strings.
The correct analogue in Rust are the Rc and Arc types, and the "make_mut" method that clones the data if and only if there is more than a reference.
Also the claim that "Rust’s COW implements the Send and Sync traits, which due to Rust safety requirements, means the implementation is designed to be used in multi-threaded applications" is technically true, but highly misleading, since Cow of course doesn't have interior mutability, and so can't be modified if shared between multiple threads (unless put in a Mutex or equivalent container) and it's Send and Sync because all "simple" types do, and not because it's "designed" to be so.
Overall, the author doesn't seem very knowledgeable about Rust.