about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-01-21 11:55:04 +1100
committerZalathar <Zalathar@users.noreply.github.com>2024-01-21 11:56:55 +1100
commit6f1944d394923fcc88a02f46de5258a36896e99e (patch)
tree5e189f75a460a89dabec361d2635d01511dd33cf /library/alloc/src
parent4cb17b4e78e0540e49d2da884cc621a6bf6f47fa (diff)
downloadrust-6f1944d394923fcc88a02f46de5258a36896e99e.tar.gz
rust-6f1944d394923fcc88a02f46de5258a36896e99e.zip
Document some alternatives to `Vec::split_off`
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/vec/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index 35ea97bfe60..fe835a8ba40 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -2167,6 +2167,12 @@ impl<T, A: Allocator> Vec<T, A> {
     /// `[at, len)`. After the call, the original vector will be left containing
     /// the elements `[0, at)` with its previous capacity unchanged.
     ///
+    /// - If you want to take ownership of the entire contents and capacity of
+    ///   the vector, see [`mem::take`] or [`mem::replace`].
+    /// - If you don't need the returned vector at all, see [`Vec::truncate`].
+    /// - If you want to take ownership of an arbitrary subslice, or you don't
+    ///   necessarily want to store the removed items in a vector, see [`Vec::drain`].
+    ///
     /// # Panics
     ///
     /// Panics if `at > len`.