libcollections: Vec<T> + &[T]

This commit is contained in:
Jorge Aparicio 2014-12-01 14:01:15 -05:00
parent 65d3a40c07
commit dbc7e17cce

View File

@ -1273,6 +1273,8 @@ impl<T> AsSlice<T> for Vec<T> {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<T: Clone, Sized? V: AsSlice<T>> Add<V, Vec<T>> for Vec<T> {
#[inline]
fn add(&self, rhs: &V) -> Vec<T> {
@ -1283,6 +1285,16 @@ impl<T: Clone, Sized? V: AsSlice<T>> Add<V, Vec<T>> for Vec<T> {
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove impl after a snapshot
impl<'a, T: Clone> Add<&'a [T], Vec<T>> for Vec<T> {
#[inline]
fn add(mut self, rhs: &[T]) -> Vec<T> {
self.push_all(rhs);
self
}
}
#[unsafe_destructor]
impl<T> Drop for Vec<T> {
fn drop(&mut self) {