The on-disk spelling of `name`: the same bytes, or the entry whose composed form equals `name`'s composed form.
(&self, name: &OsStr)
| 109 | /// The on-disk spelling of `name`: the same bytes, or the entry whose |
| 110 | /// composed form equals `name`'s composed form. |
| 111 | fn spelling_of(&self, name: &OsStr) -> Option<&OsStr> { |
| 112 | if let Some(exact) = self.names.get(name) { |
| 113 | return Some(exact.as_os_str()); |
| 114 | } |
| 115 | let text = name.to_str()?; |
| 116 | let composed: Cow<str> = if is_nfc(text) { |
| 117 | Cow::Borrowed(text) |
| 118 | } else { |
| 119 | Cow::Owned(text.nfc().collect()) |
| 120 | }; |
| 121 | if let Some(stored) = self.names.get(OsStr::new(composed.as_ref())) { |
| 122 | return Some(stored.as_os_str()); |
| 123 | } |
| 124 | self.composed |
| 125 | .get(composed.as_ref()) |
| 126 | .map(OsString::as_os_str) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /// The entries of `directory` when it is a real directory (not a symlink |
no test coverage detected