Hacker News new | ask | show | jobs
by CodesInChaos 2051 days ago
Rust has String, OsString, PathBuf, CString and Vec<u8> plus their borrowed equivalents. And the borrowed versions are often wrapped in `&`, `&mut`, `Cow` or `Box`.

So many options in the standard library alone. There are several popular crates which add even more string/buffer types.

1 comments

And the cool thing is that thanks to borrowing and traits like Deref and Display, most of these types have a zero-cost common denominator in `&str` or `&[u8]` which makes them reasonably interoperable.