Check out example codes for "convert path to pathbuf". It will help you in understanding the concepts better.

Code Example 1

let path = Path::new("some_thing/hi.txt");
let mut path_buf = PathBuf::new();
path_buf.push(path);

Learn ReactJs, React Native from akashmittal.com