This commit is contained in:
missing 2022-05-13 14:26:32 -05:00 committed by missing
parent e6f0745c83
commit a626315acc

View file

@ -432,6 +432,15 @@ impl<T: ?Sized> Vec<T> {
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]> {