diff options
| author | QuietMisdreavus <grey@quietmisdreavus.net> | 2017-07-24 10:16:16 -0500 |
|---|---|---|
| committer | QuietMisdreavus <grey@quietmisdreavus.net> | 2017-07-25 10:55:23 -0500 |
| commit | 6e36769d292ee303538ed577ad2e853de57b75a4 (patch) | |
| tree | 262b21e9eade8f3c3286b44a24bf75d57cf9b4f3 /src/liballoc | |
| parent | 5669c9988f50788b5ab5dee2d4538519d4e5663d (diff) | |
| download | rust-6e36769d292ee303538ed577ad2e853de57b75a4.tar.gz rust-6e36769d292ee303538ed577ad2e853de57b75a4.zip | |
add a note to Vec's Extend<&T> impl about its slice specialization
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/vec.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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) { |
