| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#}; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/::OsStringExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/OsStringExt#; |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/; |
| 8 | |
| 9 | use option_extrust-analyzer cargo option-ext 0.2.0 crate/::OptionExtrust-analyzer cargo option-ext 0.2.0 OptionExt#; |
| 10 | |
| 11 | /// Returns all XDG user directories obtained from $(XDG_CONFIG_HOME)/user-dirs.dirs. |
| 12 | pub fn allrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/all().(home_dir_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, user_dir_file_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { |
| 13 | let bytes = read_allrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/read_all().(user_dir_file_path).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().()); |
| 14 | parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(home_dir_path, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, &bytes) |
| 15 | } |
| 16 | |
| 17 | /// Returns a single XDG user directory obtained from $(XDG_CONFIG_HOME)/user-dirs.dirs. |
| 18 | pub fn singlerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/single().(home_dir_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, user_dir_file_path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, user_dir_name: &str) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { |
| 19 | let bytes = read_allrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/read_all().(user_dir_file_path).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().()); |
| 20 | parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(home_dir_path, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(user_dir_name), &bytes) |
| 21 | } |
| 22 | |
| 23 | fn parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(home_dir: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, user_dir: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, bytes: &[u8]) -> HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> { |
| 24 | let mut user_dirs = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 25 | |
| 26 | for line in bytes.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split().(|b| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\n') { |
| 27 | let mut single_dir_found = false; |
| 28 | let (key, value) = match split_oncerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/split_once().(line, b'=') { |
| 29 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(kv) => kv, |
| 30 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => continue, |
| 31 | }; |
| 32 | |
| 33 | let key = trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/trim_blank().(key); |
| 34 | let key = if key.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]starts_with().(b"XDG_") && key.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]ends_with().(b"_DIR") { |
| 35 | match strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&key[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().4..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#key.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) { |
| 36 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(key) => |
| 37 | if user_dir.containsrust-analyzer cargo option-ext 0.2.0 `r#impl`/impl#[`Option<T>`][`OptionExt<T>`]contains().(&key) { |
| 38 | single_dir_found = true; |
| 39 | key |
| 40 | } else if user_dir.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 41 | key |
| 42 | } else { |
| 43 | continue |
| 44 | }, |
| 45 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => continue, |
| 46 | } |
| 47 | } else { |
| 48 | continue |
| 49 | }; |
| 50 | |
| 51 | // xdg-user-dirs-update uses double quotes and we don't support anything else. |
| 52 | let value = trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/trim_blank().(value); |
| 53 | let mut value = if value.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]starts_with().(b"\"") && value.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]ends_with().(b"\"") { |
| 54 | &value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 55 | } else { |
| 56 | continue |
| 57 | }; |
| 58 | |
| 59 | // Path should be either relative to the home directory or absolute. |
| 60 | let is_relative = if value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().b"$HOME/" { |
| 61 | // "Note: To disable a directory, point it to the homedir." |
| 62 | // Source: https://www.freedesktop.org/wiki/Software/xdg-user-dirs/ |
| 63 | // Additionally directory is reassigned to homedir when removed. |
| 64 | continue |
| 65 | } else if value.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]starts_with().(b"$HOME/") { |
| 66 | value = &value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().b"$HOME/".lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 67 | true |
| 68 | } else if value.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]starts_with().(b"/") { |
| 69 | false |
| 70 | } else { |
| 71 | continue |
| 72 | }; |
| 73 | |
| 74 | let value = OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#::from_vecrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsString][OsStringExt]from_vec().(shell_unescaperust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/shell_unescape().(value)); |
| 75 | |
| 76 | let path = if is_relative { |
| 77 | let mut path = PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().(&home_dir); |
| 78 | path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(value); |
| 79 | path |
| 80 | } else { |
| 81 | PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<OsString>`]from().(value) |
| 82 | }; |
| 83 | |
| 84 | user_dirs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(key.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), path); |
| 85 | if single_dir_found { |
| 86 | break; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | user_dirs |
| 91 | } |
| 92 | |
| 93 | /// Reads the entire contents of a file into a byte vector. |
| 94 | fn read_allrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/read_all().(path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> { |
| 95 | let mut file = fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(path)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 96 | let mut bytes = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(1024); |
| 97 | file.read_to_endrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File][Read]read_to_end().(&mut bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 98 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(bytes) |
| 99 | } |
| 100 | |
| 101 | /// Returns bytes before and after first occurrence of separator. |
| 102 | fn split_oncerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/split_once().(bytes: &[u8], separator: u8) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(&[u8], &[u8])> { |
| 103 | bytes.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|b| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().separator).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|i| { |
| 104 | (&bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., &bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) |
| 105 | }) |
| 106 | } |
| 107 | |
| 108 | /// Returns a slice with leading and trailing <blank> characters removed. |
| 109 | fn trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/trim_blank().(bytes: &[u8]) -> &[u8] { |
| 110 | // Trim leading <blank> characters. |
| 111 | let i = bytes.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().take_whilerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take_while().(|b| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b' ' || *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\t').countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#count().(); |
| 112 | let bytes = &bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 113 | |
| 114 | // Trim trailing <blank> characters. |
| 115 | let i = bytes.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().take_whilerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take_while().(|b| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b' ' || *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\t').countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#count().(); |
| 116 | &bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 117 | } |
| 118 | |
| 119 | /// Unescape bytes escaped with POSIX shell double-quotes rules (as used by xdg-user-dirs-update). |
| 120 | fn shell_unescaperust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/shell_unescape().(escaped: &[u8]) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> { |
| 121 | // We assume that byte string was created by xdg-user-dirs-update which |
| 122 | // escapes all characters that might potentially have special meaning, |
| 123 | // so there is no need to check if backslash is actually followed by |
| 124 | // $ ` " \ or a <newline>. |
| 125 | |
| 126 | let mut unescaped: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(escaped.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 127 | let mut i = escaped.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().(); |
| 128 | |
| 129 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b) = i.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/cloned/impl#[`Cloned<I>`][Iterator]next().() { |
| 130 | if b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\\' { |
| 131 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b) = i.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/cloned/impl#[`Cloned<I>`][Iterator]next().() { |
| 132 | unescaped.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b); |
| 133 | } |
| 134 | } else { |
| 135 | unescaped.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | unescaped |
| 140 | } |
| 141 | |
| 142 | #[cfg(test)] |
| 143 | mod testsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/ { |
| 144 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#; |
| 145 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}; |
| 146 | |
| 147 | use superrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/::{parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs()., shell_unescaperust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/shell_unescape()., split_oncerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/split_once()., trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/trim_blank().}; |
| 148 | |
| 149 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 150 | fn test_trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_trim_blank().() { |
| 151 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"x", trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/trim_blank().(b"x")); |
| 152 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"", trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/trim_blank().(b" \t ")); |
| 153 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"hello there", trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/trim_blank().(b" \t hello there \t ")); |
| 154 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"\r\n", trim_blankrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/trim_blank().(b"\r\n")); |
| 155 | } |
| 156 | |
| 157 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 158 | fn test_split_oncerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_split_once().() { |
| 159 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, split_oncerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/split_once().(b"a b c", b'=')); |
| 160 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((b"before".as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`AsRef<[T]>`]as_ref().(), b"after".as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`AsRef<[T]>`]as_ref().())), split_oncerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/split_once().(b"before=after", b'=')); |
| 161 | } |
| 162 | |
| 163 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 164 | fn test_shell_unescaperust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_shell_unescape().() { |
| 165 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"abc", shell_unescaperust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/shell_unescape().(b"abc").as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()); |
| 166 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"x\\y$z`", shell_unescaperust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/shell_unescape().(b"x\\\\y\\$z\\`").as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()); |
| 167 | } |
| 168 | |
| 169 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 170 | fn test_parse_emptyrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_parse_empty().() { |
| 171 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(), parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/root/"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, b"")); |
| 172 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(), parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/root/"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("MUSIC"), b"")); |
| 173 | } |
| 174 | |
| 175 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 176 | fn test_absolute_path_is_acceptedrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_absolute_path_is_accepted().() { |
| 177 | let mut dirs = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 178 | dirs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("MUSIC".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/media/music")); |
| 179 | let bytes = br#"XDG_MUSIC_DIR="/media/music""#; |
| 180 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/john"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, bytes)); |
| 181 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/john"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("MUSIC"), bytes)); |
| 182 | } |
| 183 | |
| 184 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 185 | fn test_relative_path_is_rejectedrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_relative_path_is_rejected().() { |
| 186 | let dirs = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 187 | let bytes = br#"XDG_MUSIC_DIR="music""#; |
| 188 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/john"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, bytes)); |
| 189 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/john"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("MUSIC"), bytes)); |
| 190 | } |
| 191 | |
| 192 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 193 | fn test_relative_to_homerust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_relative_to_home().() { |
| 194 | let mut dirs = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 195 | dirs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("MUSIC".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/john/Music")); |
| 196 | let bytes = br#"XDG_MUSIC_DIR="$HOME/Music""#; |
| 197 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/john"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, bytes)); |
| 198 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/john"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("MUSIC"), bytes)); |
| 199 | } |
| 200 | |
| 201 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 202 | fn test_disabled_directoryrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_disabled_directory().() { |
| 203 | let dirs = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 204 | let bytes = br#"XDG_MUSIC_DIR="$HOME/""#; |
| 205 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/john"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, bytes)); |
| 206 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/john"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("MUSIC"), bytes)); |
| 207 | } |
| 208 | |
| 209 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 210 | fn test_parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/tests/test_parse_user_dirs().() { |
| 211 | let mut dirs: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 212 | dirs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("DESKTOP".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/bob/Desktop")); |
| 213 | dirs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("DOWNLOAD".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/bob/Downloads")); |
| 214 | dirs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("PICTURES".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/eve/pics")); |
| 215 | |
| 216 | let bytes = br#" |
| 217 | # This file is written by xdg-user-dirs-update |
| 218 | # If you want to change or add directories, just edit the line you're |
| 219 | # interested in. All local changes will be retained on the next run. |
| 220 | # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped |
| 221 | # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an |
| 222 | # absolute path. No other format is supported. |
| 223 | XDG_DESKTOP_DIR="$HOME/Desktop" |
| 224 | XDG_DOWNLOAD_DIR="$HOME/Downloads" |
| 225 | XDG_TEMPLATES_DIR="" |
| 226 | XDG_PUBLICSHARE_DIR="$HOME" |
| 227 | XDG_DOCUMENTS_DIR="$HOME/" |
| 228 | XDG_PICTURES_DIR="/home/eve/pics" |
| 229 | XDG_VIDEOS_DIR="$HOxyzME/Videos" |
| 230 | "#; |
| 231 | |
| 232 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/bob"), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, bytes)); |
| 233 | |
| 234 | let mut dirs: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 235 | dirs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("DESKTOP".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/bob/Desktop")); |
| 236 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/bob"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("DESKTOP"), bytes)); |
| 237 | |
| 238 | let mut dirs: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 239 | dirs.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().("PICTURES".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("/home/eve/pics")); |
| 240 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/bob"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("PICTURES"), bytes)); |
| 241 | |
| 242 | let dirs: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 243 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/bob"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("TEMPLATES"), bytes)); |
| 244 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/bob"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("PUBLICSHARE"), bytes)); |
| 245 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/bob"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("DOCUMENTS"), bytes)); |
| 246 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(dirs, parse_user_dirsrust-analyzer cargo dirs-sys 0.5.0 xdg_user_dirs/parse_user_dirs().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/bob"), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("VIDEOS"), bytes)); |
| 247 | } |
| 248 | } |