Basically what the title says. I'd like to be able to accept &str, String, PathBuf, &Path, or anything else that can be converted to a PathBuf. In other words, I'd like to own the data in a PathBuf, but I don't want to force an extra allocation if someone gives me a PathBuf already, and I don't care what they give me as long as I will eventually end up with a PathBuf.
It seems like I can get close using ToOwned
or Cow
, but neither of them do quite what I want. So it looks like this just isn't possible, but I want to make sure I'm not missing anything first.