about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Richardson <corey@octayn.net>2015-07-05 12:18:57 -0400
committerCorey Richardson <corey@octayn.net>2015-07-05 12:18:57 -0400
commitf5ea6208e040a9c59824f153c0c8bd11e5efd7c1 (patch)
tree71bb7d3c634c2458a5cb4480962f522663ed7de3
parent281cfb93abf2f590c9c33003ecc3f6416d0f8ebe (diff)
downloadrust-f5ea6208e040a9c59824f153c0c8bd11e5efd7c1.tar.gz
rust-f5ea6208e040a9c59824f153c0c8bd11e5efd7c1.zip
collections: vec_deque: add some notes on how to use VecDeque as a queue effectively
-rw-r--r--src/libcollections/vec_deque.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs
index ed47c06e7cd..0f84fc4cc73 100644
--- a/src/libcollections/vec_deque.rs
+++ b/src/libcollections/vec_deque.rs
@@ -38,6 +38,10 @@ const MINIMUM_CAPACITY: usize = 1; // 2 - 1
 
 /// `VecDeque` is a growable ring buffer, which can be used as a
 /// double-ended queue efficiently.
+///
+/// The "default" usage of this type as a queue is to use `push_back` to add to the queue, and
+/// `pop_front` to remove from the queue. `extend` and `append` push onto the back in this manner,
+/// and iterating over `VecDeque` goes front to back.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct VecDeque<T> {
     // tail and head are pointers into the buffer. Tail always points