std-type
VecDeque<T> — double-ended queue
A growable ring-buffer sequence supporting efficient additions and removals at either end. Its logical order may occupy two physical regions of the allocation. It is a useful FIFO queue and can also act as a stack. Expected stdout (not executed): Some("first") Common mistake: Assuming its elements are always represented by one contiguous slice.
Formal Syntax & Structure
rust syntaxrust
use std::collections::VecDeque;Working Example
Example Snippetrust
fn main() { use std::collections::VecDeque; let mut queue = VecDeque::from(["first", "second"]); queue.push_back("third"); println!("{:?}", queue.pop_front());}