Skip to content

Commit 215d763

Browse files
committed
Support std::iter::extend<T> for VecLike<T>
1 parent bd3b345 commit 215d763

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
use std::cmp;
99
use std::fmt;
10-
use std::iter::{IntoIterator, FromIterator};
10+
use std::iter::{Extend, IntoIterator, FromIterator};
1111
use std::mem;
1212
use std::ops;
1313
use std::ptr;
@@ -28,7 +28,8 @@ pub trait VecLike<T>:
2828
ops::Index<ops::RangeFull, Output=[T]> +
2929
ops::IndexMut<ops::RangeFull> +
3030
ops::Deref +
31-
ops::DerefMut {
31+
ops::DerefMut +
32+
Extend<T> {
3233

3334
fn len(&self) -> usize;
3435
fn push(&mut self, value: T);
@@ -361,8 +362,8 @@ impl<A: Array> FromIterator<A::Item> for SmallVec<A> {
361362
}
362363
}
363364

364-
impl<A: Array> SmallVec<A> {
365-
pub fn extend<I: IntoIterator<Item=A::Item>>(&mut self, iterable: I) {
365+
impl<A: Array> Extend<A::Item> for SmallVec<A> {
366+
fn extend<I: IntoIterator<Item=A::Item>>(&mut self, iterable: I) {
366367
let iter = iterable.into_iter();
367368
let (lower_size_bound, _) = iter.size_hint();
368369

0 commit comments

Comments
 (0)