TIL: serde's borrowing can be treacherous

79 points by yossarian


wrs

Cow<T> is one of a few Rust stdlib types where I found I had to learn to just ignore the name because it kept confusing me. It’s commonly used as a returned value that has already been borrowed or allocated — it has nothing to do with whether there will be or ever were any writes to it. (The idea itself is quite elegant, and this is probably just me, and sadly I don’t have a better suggestion…)

junon

TIL serde can even do that. A good nuanced case of "library doing the right thing that is otherwise unintuitive at first". Good writeup!