Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/collections/deque"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
error |
alloc/error |
deque.dodo |
option |
core/option |
deque.dodo |
vector |
std/collections/vector |
deque.dodo |
Deque
Struct · Source
Allocation-dependent ring buffer. Growth linearizes a wrapped prefix by moving it into the new half, preserving FIFO order and every payload.
pub struct Deque<T, A> {
// Private implementation fields omitted.
}
Deque.next
Function · Source
Cursor starts at zero. Each call yields one logical element.
pub fn next(&self, cursor: &mut usize) -> Option<&T> from(self)
Deque.len
Function · Source
pub fn len(&self) -> usize
Deque.capacity
Function · Source
pub fn capacity(&self) -> usize
Deque.is_empty
Function · Source
pub fn is_empty(&self) -> bool
Deque.get
Function · Source
pub fn get(&self, index: usize) -> Option<&T>
Deque.push_back
Function · Source
pub fn push_back(&mut self, value: T) -> void!error.AllocError stores(self, value)
Deque.push_front
Function · Source
pub fn push_front(&mut self, value: T) -> void!error.AllocError stores(self, value)
Deque.pop_front
Function · Source
pub fn pop_front(&mut self) -> Option<T> from(self.stored)
Deque.pop_back
Function · Source
pub fn pop_back(&mut self) -> Option<T> from(self.stored)
Deque.clear
Function · Source
pub fn clear(&mut self)
new
Function · Source
SAFETY: allocator must satisfy vector.new’s capability contract.
pub unsafe fn new<T, A>(allocator: A) -> Deque<T, A> from(allocator)
Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.