From 6e36769d292ee303538ed577ad2e853de57b75a4 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus <grey@quietmisdreavus.net> Date: Mon, 24 Jul 2017 10:16:16 -0500 Subject: [PATCH] add a note to Vec's Extend<&T> impl about its slice specialization --- src/liballoc/vec.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 780a51aec3b..b7d8059adb1 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -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) {