Rollup merge of #46985 - Diggsey:path-component-asref, r=alexcrichton
Implement AsRef<Path> for Component Fixes #41866
This commit is contained in:
@@ -576,6 +576,13 @@ impl<'a> AsRef<OsStr> for Component<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[stable(feature = "path_component_asref", since = "1.24.0")]
|
||||||
|
impl<'a> AsRef<Path> for Component<'a> {
|
||||||
|
fn as_ref(&self) -> &Path {
|
||||||
|
self.as_os_str().as_ref()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// An iterator over the [`Component`]s of a [`Path`].
|
/// An iterator over the [`Component`]s of a [`Path`].
|
||||||
///
|
///
|
||||||
/// This `struct` is created by the [`components`] method on [`Path`].
|
/// This `struct` is created by the [`components`] method on [`Path`].
|
||||||
|
|||||||
Reference in New Issue
Block a user