Skip to content

Commit 91f1e51

Browse files
seanmonstaralexcrichton
authored andcommitted
collections: impl AsRef<[u8]> for String
1 parent 5d412c6 commit 91f1e51

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libcollections/string.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,14 @@ impl AsRef<str> for String {
10051005
}
10061006
}
10071007

1008+
#[stable(feature = "rust1", since = "1.0.0")]
1009+
impl AsRef<[u8]> for String {
1010+
#[inline]
1011+
fn as_ref(&self) -> &[u8] {
1012+
self.as_bytes()
1013+
}
1014+
}
1015+
10081016
#[stable(feature = "rust1", since = "1.0.0")]
10091017
impl<'a> From<&'a str> for String {
10101018
#[inline]

0 commit comments

Comments
 (0)