Skip to content

Commit d9b73e1

Browse files
committed
Add AsRef implementations for Path
1 parent 339bdc0 commit d9b73e1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

library/std/src/path.rs

+24
Original file line numberDiff line numberDiff line change
@@ -3358,6 +3358,30 @@ impl AsRef<Path> for PathBuf {
33583358
}
33593359
}
33603360

3361+
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
3362+
impl AsRef<Path> for Box<str> {
3363+
#[inline]
3364+
fn as_ref(&self) -> &Path {
3365+
Path::new(self)
3366+
}
3367+
}
3368+
3369+
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
3370+
impl AsRef<Path> for Rc<str> {
3371+
#[inline]
3372+
fn as_ref(&self) -> &Path {
3373+
Path::new(self)
3374+
}
3375+
}
3376+
3377+
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
3378+
impl AsRef<Path> for Arc<str> {
3379+
#[inline]
3380+
fn as_ref(&self) -> &Path {
3381+
Path::new(self)
3382+
}
3383+
}
3384+
33613385
#[stable(feature = "path_into_iter", since = "1.6.0")]
33623386
impl<'a> IntoIterator for &'a PathBuf {
33633387
type Item = &'a OsStr;

0 commit comments

Comments
 (0)