Skip to content

Commit 6f1944d

Browse files
committed
Document some alternatives to Vec::split_off
1 parent 4cb17b4 commit 6f1944d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: library/alloc/src/vec/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,12 @@ impl<T, A: Allocator> Vec<T, A> {
21672167
/// `[at, len)`. After the call, the original vector will be left containing
21682168
/// the elements `[0, at)` with its previous capacity unchanged.
21692169
///
2170+
/// - If you want to take ownership of the entire contents and capacity of
2171+
/// the vector, see [`mem::take`] or [`mem::replace`].
2172+
/// - If you don't need the returned vector at all, see [`Vec::truncate`].
2173+
/// - If you want to take ownership of an arbitrary subslice, or you don't
2174+
/// necessarily want to store the removed items in a vector, see [`Vec::drain`].
2175+
///
21702176
/// # Panics
21712177
///
21722178
/// Panics if `at > len`.

0 commit comments

Comments
 (0)