diff --git a/src/lib.rs b/src/lib.rs index 59f2ca5..9d4e829 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -432,6 +432,15 @@ impl Vec { 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>(&mut self, iter: I) where for<'a> &'a U: CoerceUnsized<&'a T> { + for item in iter { + self.push_unsize(item); + } + } } impl Vec<[T]> {