about summary refs log tree commit diff
path: root/library/alloc/src/vec/mod.rs
diff options
context:
space:
mode:
authorWaffle <waffle.lapkin@gmail.com>2021-02-03 14:14:55 +0300
committerWaffle <waffle.lapkin@gmail.com>2021-02-03 14:14:55 +0300
commit76223fafb4f6d552ff7b310a00dd5ee23cb4a1b6 (patch)
tree959abc67ecd9c11481a237b8c3251bb67497ed9c /library/alloc/src/vec/mod.rs
parent476a57a628ea358d01a2830db67e24149521f144 (diff)
downloadrust-76223fafb4f6d552ff7b310a00dd5ee23cb4a1b6.tar.gz
rust-76223fafb4f6d552ff7b310a00dd5ee23cb4a1b6.zip
Add note to `Vec::split_at_spare_mut` docs that the method is low-level
Diffstat (limited to 'library/alloc/src/vec/mod.rs')
-rw-r--r--library/alloc/src/vec/mod.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index df449ca6803..8620200b038 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -1837,6 +1837,21 @@ impl<T, A: Allocator> Vec<T, A> {
     ///
     /// [`set_len`]: Vec::set_len
     ///
+    /// Note that this is a low-level API, which should be used with care for
+    /// optimization purposes. If you need to append data to a `Vec`
+    /// you can use [`push`], [`extend`], [`extend_from_slice`],
+    /// [`extend_from_within`], [`insert`], [`append`], [`resize`] or
+    /// [`resize_with`], depending on your exact needs.
+    ///
+    /// [`push`]: Vec::push
+    /// [`extend`]: Vec::extend
+    /// [`extend_from_slice`]: Vec::extend_from_slice
+    /// [`extend_from_within`]: Vec::extend_from_within
+    /// [`insert`]: Vec::insert
+    /// [`append`]: Vec::append
+    /// [`resize`]: Vec::resize
+    /// [`resize_with`]: Vec::resize_with
+    ///
     /// # Examples
     ///
     /// ```