diff options
| author | Diggory Blake <diggsey@googlemail.com> | 2017-12-24 17:02:24 +0000 |
|---|---|---|
| committer | Diggory Blake <diggsey@googlemail.com> | 2017-12-28 13:27:53 +0000 |
| commit | e0855ff4a13ea79daa56d23a25f827fe86e8147b (patch) | |
| tree | 6c4b1daa649e683bcd51857a80c7e4c8d0d9d15a /src/libstd/path.rs | |
| parent | 304717bd86e42bc9b0c45ea5a6068e7ed9d13f2f (diff) | |
| download | rust-e0855ff4a13ea79daa56d23a25f827fe86e8147b.tar.gz rust-e0855ff4a13ea79daa56d23a25f827fe86e8147b.zip | |
Implement AsRef<Path> for Component
Diffstat (limited to 'src/libstd/path.rs')
| -rw-r--r-- | src/libstd/path.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index eb125a4737a..ff528903b75 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -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`]. /// /// This `struct` is created by the [`components`] method on [`Path`]. |
