Skip to content

collections: vec_deque: add some notes on how to use VecDeque as a queue effectively #26817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down