seems like there's a couple of distinct ways to do copy-on-write: Rc::make_mut if you have owned data, and Cow if you have borrowed data, have I got that right?
-
-
Replying to @mountain_ghosts
Sounds right. The only differences I can think of are that Rc additionally encodes that the underlying data is heap allocated and that Rc uses interior mutability while Cow uses lifetimes.
1 reply 0 retweets 0 likes -
Replying to @yaahc_ @mountain_ghosts
actually now im questioning my understanding of Cow, the docs say its a smart pointer.... I must look into this further.
1 reply 0 retweets 0 likes -
Replying to @yaahc_ @mountain_ghosts
looks like my mental definition of a smart pointer was just wrong. Cow definitely doesn't do any memory management but its still a smart pointer. Now im wondering what happens when you do make_mut on an Rc<str>, I'm assuming it wont end up with a String like Cow does.
2 replies 0 retweets 1 like
make_mut requires Clone.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.