tilde_parser/
lib.rs

1use std::path::PathBuf;
2
3fn parse_tilde(path: &str) -> String {
4    let path = tilde_expand::tilde_expand(path.as_bytes());
5    String::from_utf8(path).unwrap()
6}
7
8
9pub trait PathExpandUser {
10    fn expanduser(&mut self);
11}
12
13impl PathExpandUser for PathBuf {
14    fn expanduser(&mut self) {
15        let path = tilde_expand::tilde_expand(self.to_str().unwrap().as_bytes());
16        let path = String::from_utf8(path).unwrap();
17        let path = Self::from(path);
18        *self = path;
19    }
20}