Document some alternatives to Vec::split_off

This commit is contained in:
Zalathar 2024-01-21 11:55:04 +11:00
parent 4cb17b4e78
commit 6f1944d394

View File

@ -2167,6 +2167,12 @@ pub fn is_empty(&self) -> bool {
/// `[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`.