On this page
  1. VecDeque
  2. Signature & Overview
  3. Notes & Pitfalls
  4. Example

VecDeque

Prev: `BTreeMap` | Up: collections | Next: `BinaryHeap`
Rel: collections, rust/builtins
Ref: Rust std — VecDeque
Tags: #public #prog #rust #stdlib #collections #tier/standard


Signature & Overview

VecDeque<T>

Double-ended growable ring buffer with $O(1)$ push_front/pop_front/push_back.

Notes & Pitfalls

Example

use std::collections::VecDeque;

fn main() {
    let mut q = VecDeque::from(["first", "second"]);
    q.push_back("third");
    assert_eq!(q.pop_front(), Some("first"));
    assert_eq!(q.front(), Some(&"second"));
}

Linked from

Related notes