From e0855ff4a13ea79daa56d23a25f827fe86e8147b Mon Sep 17 00:00:00 2001 From: Diggory Blake Date: Sun, 24 Dec 2017 17:02:24 +0000 Subject: [PATCH] Implement AsRef for Component --- src/libstd/path.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index eb125a4737a1c..ff528903b757f 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -576,6 +576,13 @@ impl<'a> AsRef for Component<'a> { } } +#[stable(feature = "path_component_asref", since = "1.24.0")] +impl<'a> AsRef 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`].