Skip to content

Commit

Permalink
Rollup merge of rust-lang#46985 - Diggsey:path-component-asref, r=ale…
Browse files Browse the repository at this point in the history
…xcrichton

Implement AsRef<Path> for Component

Fixes rust-lang#41866
  • Loading branch information
kennytm authored Jan 12, 2018
2 parents 0b90e4e + e0855ff commit 743b976
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
Expand Down

0 comments on commit 743b976

Please sign in to comment.