about summary refs log tree commit diff
path: root/src/liballoc/vec.rs
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2017-07-26 06:15:03 -0600
committerGitHub <noreply@github.com>2017-07-26 06:15:03 -0600
commit3751d20ec928c3ec41520ebc466c4feb3d7f63f4 (patch)
treeaf983d9ec8dcabb9f18c8d09932c157d93196c15 /src/liballoc/vec.rs
parentb58339205803689b0037b46bddc62351d0b44ad3 (diff)
parent6e36769d292ee303538ed577ad2e853de57b75a4 (diff)
downloadrust-3751d20ec928c3ec41520ebc466c4feb3d7f63f4.tar.gz
rust-3751d20ec928c3ec41520ebc466c4feb3d7f63f4.zip
Rollup merge of #43455 - QuietMisdreavus:extend-spec-docs, r=steveklabnik
add a note to Vec's Extend<&T> impl about its slice specialization

From the regular documentation view, it's not at all apparent that [this specialization](https://github.com/rust-lang/rust/blob/5669c9988f50788b5ab5dee2d4538519d4e5663d/src/liballoc/vec.rs#L1879-L1891) exists for `slice::Iter`. This adds a documentation blurb to the Extend impl itself to note that this optimization exists.
Diffstat (limited to 'src/liballoc/vec.rs')
-rw-r--r--src/liballoc/vec.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 8a1d14b48a1..da47ca50983 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) {