I want a function that mutates the underlying String of a PathBuf object, but all I could achieve now is creation of a new object instead.
use std::path::{Path, PathBuf};
fn expanduser(path: &mut PathBuf) -> PathBuf {
return PathBuf::from(
&path
.to_str()
.unwrap()
.replace("~", PathBuf::home().to_str().unwrap()),
);
}