implicit-clone
implicit-clone copied to clipboard
Add `IPath`
The Path type and similar also need the IString treatment when used in an environment that wants more immutability. Basically, copy the string module, add some Path-specific utilities, and then have a better experience with them.
In particular, the methods like canonicalize and read_dir should be mirrored to return IPath as opposed to be defaulted to via Deref to Path and PathBuf. This will let users stay in the immutable world a bit longer. Also a new method should be put in place (just like in &Path) to allow easy conversion from &str and such.
Some methods operate on OsString/OsStr. It might be preferable to cover them as well, but I am not sure if IOsString is desired. Maybe methods like file_name_lossy and into_iter_lossy should be added instead, that would give users IString instead.