extend
This commit is contained in:
parent
e6f0745c83
commit
a626315acc
|
@ -432,6 +432,15 @@ impl<T: ?Sized> Vec<T> {
|
||||||
dealloc(self.ptr.as_ptr(), Layout::from_size_align_unchecked(self.capacity, 8));
|
dealloc(self.ptr.as_ptr(), Layout::from_size_align_unchecked(self.capacity, 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Extends this vector with an iterator.
|
||||||
|
///
|
||||||
|
/// Similar to [`Extend::extend`], but seperate to prevent conflicting implementations.
|
||||||
|
pub fn extend_unsize<U, I: IntoIterator<Item = U>>(&mut self, iter: I) where for<'a> &'a U: CoerceUnsized<&'a T> {
|
||||||
|
for item in iter {
|
||||||
|
self.push_unsize(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Vec<[T]> {
|
impl<T> Vec<[T]> {
|
||||||
|
|
Loading…
Reference in a new issue