5 ms·
Are you sure that code expresses the same pattern? It looks like Rust's COW can only transition from Borrowed to Owned by making a copy. Swift's COW works by dy
by millstone 8y ago
Are you sure that code expresses the same pattern? It looks like Rust's COW can only transition from Borrowed to Owned by making a copy. Swift's COW works by dynamically inspecting the reference count.
- giornogiovanna 8y agoRight, unless I'm mistaken, what you want is `Rc` with `Rc::make_mut`[0], not `Cow`. [0]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.make_mut https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#metho...