Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
doc.rust-lang.org
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the vector as much as possible.
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn shrink_to(&mut self, min_capacity: usize)
Shrinks the capacity of the vector with a lower bound.
method alloc Stable since 1.56.0 Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn set_len(&mut self, new_len: usize)
Forces the length of the vector to new_len.
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn retain_mut<F>(&mut self, f: F)
Retains only the elements specified by the predicate, passing a mutable reference to it.
method alloc Stable since 1.61.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn retain<F>(&mut self, f: F)
Retains only the elements specified by the predicate.
method alloc Stable since 1.0.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn resize_with<F>(&mut self, new_len: usize, f: F)
Resizes the Vec in-place so that len is equal to new_len.
method alloc Stable since 1.33.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn resize(&mut self, new_len: usize, value: T)
Resizes the Vec in-place so that len is equal to new_len.
method alloc Stable since 1.5.0 Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for at least additional more elements to be inserted in the given Vec<T>. Unlike reserve, this will not deliberately over-allocate to speculatively avoid frequent allocations. After calling reserve_exact, capacity will be greater than or equal to self.len() + additional. Does nothing if the capacity is already sufficient.
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
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 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 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 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 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 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 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 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 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 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 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
"Man, rust crates are so allergic to 1.0 that they'll skip all the way to version 22."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.