Skip to content

collections: vec_deque: rename "ringbuf" to "VecDeque" in doc comments #26806

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
28 changes: 14 additions & 14 deletions src/libcollections/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct VecDeque<T> {
// tail and head are pointers into the buffer. Tail always points
// to the first element that could be read, Head always points
// to where data should be written.
// If tail == head the buffer is empty. The length of the ringbuf
// If tail == head the buffer is empty. The length of the ringbuffer
// is defined as the distance between the two.

tail: usize,
Expand Down Expand Up @@ -309,7 +309,7 @@ impl<T> VecDeque<T> {
}

/// Reserves capacity for at least `additional` more elements to be inserted in the given
/// `Ringbuf`. The collection may reserve more space to avoid frequent reallocations.
/// `VecDeque`. The collection may reserve more space to avoid frequent reallocations.
///
/// # Panics
///
Expand Down Expand Up @@ -385,10 +385,10 @@ impl<T> VecDeque<T> {
}
}

/// Shrinks the capacity of the ringbuf as much as possible.
/// Shrinks the capacity of the `VecDeque` as much as possible.
///
/// It will drop down as close as possible to the length but the allocator may still inform the
/// ringbuf that there is space for a few more elements.
/// `VecDeque` that there is space for a few more elements.
///
/// # Examples
///
Expand All @@ -404,7 +404,7 @@ impl<T> VecDeque<T> {
/// ```
pub fn shrink_to_fit(&mut self) {
// +1 since the ringbuffer always leaves one space empty
// len + 1 can't overflow for an existing, well-formed ringbuf.
// len + 1 can't overflow for an existing, well-formed ringbuffer.
let target_cap = cmp::max(self.len() + 1, MINIMUM_CAPACITY + 1).next_power_of_two();
if target_cap < self.cap {
// There are three cases of interest:
Expand Down Expand Up @@ -472,9 +472,9 @@ impl<T> VecDeque<T> {
}
}

/// Shortens a ringbuf, dropping excess elements from the back.
/// Shortens a `VecDeque`, dropping excess elements from the back.
///
/// If `len` is greater than the ringbuf's current length, this has no
/// If `len` is greater than the `VecDeque`'s current length, this has no
/// effect.
///
/// # Examples
Expand Down Expand Up @@ -858,8 +858,8 @@ impl<T> VecDeque<T> {
self.tail <= self.head
}

/// Removes an element from anywhere in the ringbuf and returns it, replacing it with the last
/// element.
/// Removes an element from anywhere in the `VecDeque` and returns it, replacing it with the
/// last element.
///
/// This does not preserve ordering, but is O(1).
///
Expand Down Expand Up @@ -892,7 +892,7 @@ impl<T> VecDeque<T> {
self.pop_back()
}

/// Removes an element from anywhere in the ringbuf and returns it,
/// Removes an element from anywhere in the `VecDeque` and returns it,
/// replacing it with the first element.
///
/// This does not preserve ordering, but is O(1).
Expand Down Expand Up @@ -926,13 +926,13 @@ impl<T> VecDeque<T> {
self.pop_front()
}

/// Inserts an element at position `i` within the ringbuf. Whichever
/// Inserts an element at position `i` within the `VecDeque`. Whichever
/// end is closer to the insertion point will be moved to make room,
/// and all the affected elements will be moved to new positions.
///
/// # Panics
///
/// Panics if `i` is greater than ringbuf's length
/// Panics if `i` is greater than `VecDeque`'s length
///
/// # Examples
/// ```
Expand Down Expand Up @@ -1132,7 +1132,7 @@ impl<T> VecDeque<T> {
}
}

/// Removes and returns the element at position `i` from the ringbuf.
/// Removes and returns the element at position `i` from the `VecDeque`.
/// Whichever end is closer to the removal point will be moved to make
/// room, and all the affected elements will be moved to new positions.
/// Returns `None` if `i` is out of bounds.
Expand Down Expand Up @@ -1428,7 +1428,7 @@ impl<T> VecDeque<T> {
}

impl<T: Clone> VecDeque<T> {
/// Modifies the ringbuf in-place so that `len()` is equal to new_len,
/// Modifies the `VecDeque` in-place so that `len()` is equal to new_len,
/// either by removing excess elements or by appending copies of a value to the back.
///
/// # Examples
Expand Down