Rollup merge of #46985 - Diggsey:path-component-asref, r=alexcrichton
Implement AsRef<Path> for Component Fixes #41866
This commit is contained in:
commit
743b976b36
1 changed files with 7 additions and 0 deletions
|
@ -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`].
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue