Rollup merge of #23865 - seanmonstar:into-cow, r=alexcrichton

r? @aturon
This commit is contained in:
Manish Goregaokar 2015-03-31 09:04:38 +05:30
commit 464c18ce9c

View File

@ -1019,11 +1019,28 @@ impl AsRef<str> for String {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> From<&'a str> for String {
#[inline]
fn from(s: &'a str) -> String {
s.to_string()
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> From<&'a str> for Cow<'a, str> {
#[inline]
fn from(s: &'a str) -> Cow<'a, str> {
Cow::Borrowed(s)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a> From<String> for Cow<'a, str> {
#[inline]
fn from(s: String) -> Cow<'a, str> {
Cow::Owned(s)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Into<Vec<u8>> for String {
fn into(self) -> Vec<u8> {
@ -1031,7 +1048,7 @@ impl Into<Vec<u8>> for String {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`")]
impl IntoCow<'static, str> for String {
#[inline]
fn into_cow(self) -> Cow<'static, str> {
@ -1039,7 +1056,7 @@ impl IntoCow<'static, str> for String {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`")]
impl<'a> IntoCow<'a, str> for &'a str {
#[inline]
fn into_cow(self) -> Cow<'a, str> {