doc.rust-lang.org
pub fn pop_front_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T>
Removes and returns the first element from the deque if the predicate returns true, or None if the predicate returns false or the deque is empty (the predicate will not be called in that case).
method
alloc
Stable since 1.93.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop_front(&mut self) -> Option<T>
Removes the first element and returns it, or None if the deque is empty.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop_back_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T>
Removes and returns the last element from the deque if the predicate returns true, or None if the predicate returns false or the deque is empty (the predicate will not be called in that case).
method
alloc
Stable since 1.93.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop_back(&mut self) -> Option<T>
Removes the last element from the deque 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 partition_point<P>(&self, pred: P) -> usize
Returns the index of the partition point according to the given predicate (the index of the first element of the second partition).
method
alloc
Stable since 1.54.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> VecDeque<T>
Creates an empty deque.
associated_function
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn make_contiguous(&mut self) -> &mut [T]
Rearranges the internal storage of this deque so it is one contiguous slice, which is then returned.
method
alloc
Stable since 1.48.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn len(&self) -> usize
Returns the number of elements in the deque.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Returns a front-to-back iterator that returns mutable references.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter(&self) -> Iter<'_, T>
Returns a front-to-back iterator.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_empty(&self) -> bool
Returns true if the deque is empty.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert_mut(&mut self, index: usize, value: T) -> &mut T
Inserts an element at index within the deque, shifting all elements with indices greater than or equal to index towards the back, and returning a reference to it.
method
alloc
Stable since 1.95.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn insert(&mut self, index: usize, value: T)
Inserts an element at index within the deque, shifting all elements with indices greater than or equal to index towards the back.
method
alloc
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
Provides a mutable reference to the element at the given index.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn get(&self, index: usize) -> Option<&T>
Provides a reference to the element at the given index.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn front_mut(&mut self) -> Option<&mut T>
Provides a mutable reference to the front element, or None if the deque is empty.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn front(&self) -> Option<&T>
Provides a reference to the front element, or None if the deque is empty.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn drain<R>(&mut self, range: R) -> Drain<'_, T, A>
Removes the specified range from the deque in bulk, returning all removed elements as an iterator. If the iterator is dropped before being fully consumed, it drops the remaining removed elements.
method
alloc
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn contains(&self, x: &T) -> bool
Returns true if the deque contains an element equal to the given value.
method
alloc
Stable since 1.12.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn clear(&mut self)
Clears the deque, removing all values.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly