doc.rust-lang.org
pub fn extend_from_within<R>(&mut self, src: R)
Given a range src, clones a slice of elements in that range and appends it to the end.
method
alloc
Stable since 1.53.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn extract_if<F, R>(&mut self, range: R, filter: F) -> ExtractIf<'_, T, F, A>
Creates an iterator which uses a closure to determine if an element in the range should be removed.
method
alloc
Stable since 1.87.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn from_parts(ptr: NonNull<T>, length: usize, capacity: usize) -> Self
Creates a Vec<T> directly from a NonNull pointer, a length, and a capacity.
associated_function
alloc
Stable since 1.100.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn from_raw_parts(ptr: *mut T, length: usize, capacity: usize) -> Self
Creates a Vec<T> directly from a pointer, a length, and a capacity.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert(&mut self, index: usize, element: T)
Inserts an element at position index within the vector, shifting all elements after it to the right.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert_mut(&mut self, index: usize, element: T) -> &mut T
Inserts an element at position index within the vector, shifting all elements after it to the right, and returning a reference to the new element.
method
alloc
Stable since 1.95.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_boxed_slice(self) -> Box<[T], A>
Converts the vector into Box<[T]>.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_flattened(self) -> Vec<T, A>
Takes a Vec<[T; N]> and flattens it into a Vec<T>.
method
alloc
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn into_parts(self) -> (NonNull<T>, usize, usize)
Decomposes a Vec<T> into its raw components: (NonNull pointer, length, capacity).
method
alloc
Stable since 1.100.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn into_raw_parts(self) -> (*mut T, usize, usize)
Decomposes a Vec<T> into its raw components: (pointer, length, capacity).
method
alloc
Stable since 1.93.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_empty(&self) -> bool
Returns true if the vector contains no elements.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn leak<'a>(self) -> &'a mut [T]
Consumes and leaks the Vec, returning a mutable reference to the contents, &'a mut [T].
method
alloc
Stable since 1.47.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn len(&self) -> usize
Returns the number of elements in the vector, also referred to as its 'length'.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> Self
Constructs a new, empty Vec<T>.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop(&mut self) -> Option<T>
Removes the last element from a vector and returns it, or None if it is empty.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T>
Removes and returns the last element from a vector if the predicate returns true, or None if the predicate returns false or the vector is empty (the predicate will not be called in that case).
method
alloc
Stable since 1.86.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn push(&mut self, value: T)
Appends an element to the back of a collection.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn push_mut(&mut self, value: T) -> &mut T
Appends an element to the back of a collection, returning a reference to it.
method
alloc
Stable since 1.95.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn remove(&mut self, index: usize) -> T
Removes and returns the element at position index within the vector, shifting all elements after it to the left.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more elements to be inserted in the given Vec<T>. The collection may reserve more space to speculatively avoid frequent reallocations. After calling reserve, capacity will be greater than or equal to self.len() + additional. Does nothing if capacity is already sufficient.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly