Recommend swap_remove in Vec::remove docs
This commit is contained in:
@@ -1360,6 +1360,12 @@ impl<T, A: Allocator> Vec<T, A> {
|
|||||||
/// Removes and returns the element at position `index` within the vector,
|
/// Removes and returns the element at position `index` within the vector,
|
||||||
/// shifting all elements after it to the left.
|
/// shifting all elements after it to the left.
|
||||||
///
|
///
|
||||||
|
/// Note: Because this shifts over the remaining elements, it has a
|
||||||
|
/// worst-case performance of O(n). If you don't need the order of elements
|
||||||
|
/// to be preserved, use [`swap_remove`] instead.
|
||||||
|
///
|
||||||
|
/// [`swap_remove`]: Vec::swap_remove
|
||||||
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// Panics if `index` is out of bounds.
|
/// Panics if `index` is out of bounds.
|
||||||
|
|||||||
Reference in New Issue
Block a user