Skip to content

Commit 339bdc0

Browse files
committed
Add AsRef implementations for OsStr
1 parent db02eaa commit 339bdc0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

library/std/src/ffi/os_str.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,30 @@ impl AsRef<OsStr> for String {
17011701
}
17021702
}
17031703

1704+
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
1705+
impl AsRef<OsStr> for Box<str> {
1706+
#[inline]
1707+
fn as_ref(&self) -> &OsStr {
1708+
(&**self).as_ref()
1709+
}
1710+
}
1711+
1712+
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
1713+
impl AsRef<OsStr> for Rc<str> {
1714+
#[inline]
1715+
fn as_ref(&self) -> &OsStr {
1716+
(&**self).as_ref()
1717+
}
1718+
}
1719+
1720+
#[stable(feature = "smart_ptr_as_ref_str", since = "CURRENT_RUSTC_VERSION")]
1721+
impl AsRef<OsStr> for Arc<str> {
1722+
#[inline]
1723+
fn as_ref(&self) -> &OsStr {
1724+
(&**self).as_ref()
1725+
}
1726+
}
1727+
17041728
impl FromInner<Buf> for OsString {
17051729
#[inline]
17061730
fn from_inner(buf: Buf) -> OsString {

0 commit comments

Comments
 (0)