libcollections: String + &str

This commit is contained in:
Jorge Aparicio 2014-12-01 14:08:56 -05:00
parent dbc7e17cce
commit 076e932fd5

View File

@ -855,6 +855,8 @@ impl<'a, S: Str> Equiv<S> for String {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
#[experimental = "waiting on Add stabilization"]
impl<S: Str> Add<S, String> for String {
fn add(&self, other: &S) -> String {
@ -864,6 +866,14 @@ impl<S: Str> Add<S, String> for String {
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<'a> Add<&'a str, String> for String {
fn add(mut self, other: &str) -> String {
self.push_str(other);
self
}
}
impl ops::Slice<uint, str> for String {
#[inline]
fn as_slice_<'a>(&'a self) -> &'a str {