Skip to content

Commit

Permalink
add a note to Vec's Extend<&T> impl about its slice specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
QuietMisdreavus committed Jul 25, 2017
1 parent 5669c99 commit 6e36769
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1962,6 +1962,12 @@ impl<T> Vec<T> {

}

/// Extend implementation that copies elements out of references before pushing them onto the Vec.
///
/// This implementation is specialized for slice iterators, where it uses [`copy_from_slice`] to
/// append the entire slice at once.
///
/// [`copy_from_slice`]: ../../std/primitive.slice.html#method.copy_from_slice
#[stable(feature = "extend_ref", since = "1.2.0")]
impl<'a, T: 'a + Copy> Extend<&'a T> for Vec<T> {
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
Expand Down

0 comments on commit 6e36769

Please sign in to comment.