提交 743b976b 编写于 作者: K kennytm 提交者: GitHub

Rollup merge of #46985 - Diggsey:path-component-asref, r=alexcrichton

Implement AsRef<Path> for Component

Fixes #41866
......@@ -576,6 +576,13 @@ fn as_ref(&self) -> &OsStr {
}
}
#[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`].
///
/// This `struct` is created by the [`components`] method on [`Path`].
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册