A deque, or double-ended queue, supports insertion and removal at both its front and back. Rust provides it as VecDeque, backed by a growable Vec. section 3.2.3
Use VecDeque's operations according to the access pattern you need:
- push_front and pop_front support stack behavior: the newest value is removed first. section 3.2.3
- push_back and pop_back provide insertion and removal at the opposite end. section 3.2.3
- A wrapper such as RpnStack can expose only the deque behavior required by an application. section 3.2.3
Using a deque as an RPN stack
Store parsed numbers with push_front, then retrieve operands with pop_front. The expression `3 4 +` pushes 3 and 4, pops them for addition, and pushes the result.


