I’d like to propose a naming change to the Rust standard library: rename Path to PathStr and PathBuf to PathString. To explain, let’s look at this table:
| Guarantees |
“Slice” Variety |
“Owned” Variety |
| UTF-8 |
str |
String |
| C-compatible |
CStr |
CString |
| OS-compatible |
OsStr |
OsString |
| System path |
Path |
PathBuf |
As you can see, the Str/String split is consistent, except for the two path types: Path and PathBuf. Obviously, backwards compatibility concerns mean that the current names can’t be eliminated. But they can be deprecated, in favor of PathStr and PathString. The way of doing it would likely be to rename the types, and then provide the old names as aliases.
This is a nit, but fixing it seems like something that would make Rust’s string types more consistent, and approachable for newer Rust programmers.
Thoughts?