We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Prefix
1 parent a6e0aa2 commit c1ea7bdCopy full SHA for c1ea7bd
library/std/src/path.rs
@@ -2892,6 +2892,14 @@ impl cmp::PartialEq for Path {
2892
impl Hash for Path {
2893
fn hash<H: Hasher>(&self, h: &mut H) {
2894
let bytes = self.as_u8_slice();
2895
+ let prefix_len = match parse_prefix(&self.inner) {
2896
+ Some(prefix) => {
2897
+ prefix.hash(h);
2898
+ prefix.len()
2899
+ }
2900
+ None => 0,
2901
+ };
2902
+ let bytes = &bytes[prefix_len..];
2903
2904
let mut component_start = 0;
2905
let mut bytes_hashed = 0;
library/std/src/sys/unix/path.rs
@@ -11,6 +11,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
11
b == b'/'
12
}
13
14
+#[inline]
15
pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> {
16
None
17
0 commit comments