collections: impl AsRef<[u8]> for String

This commit is contained in:
Sean McArthur 2015-05-06 15:53:53 -07:00
parent aaa3641754
commit 093ebd5a62

View File

@ -1057,6 +1057,14 @@ impl AsRef<str> for String {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl AsRef<[u8]> for String {
#[inline]
fn as_ref(&self) -> &[u8] {
self.as_bytes()
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> From<&'a str> for String {
#[cfg(not(test))]