Skip to content

Commit 79a9805

Browse files
committed
collections: Deprecate push_back/pop_back
1 parent d36a8f3 commit 79a9805

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/libcollections/dlist.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,15 @@ impl<T> Deque<T> for DList<T> {
253253
/// Add an element last in the list
254254
///
255255
/// O(1)
256+
#[deprecated = "use the `push` method"]
256257
fn push_back(&mut self, elt: T) {
257258
self.push_back_node(box Node::new(elt))
258259
}
259260

260261
/// Remove the last element and return it, or None if the list is empty
261262
///
262263
/// O(1)
264+
#[deprecated = "use the `pop` method"]
263265
fn pop_back(&mut self) -> Option<T> {
264266
self.pop_back_node().map(|box Node{value, ..}| value)
265267
}

src/libcollections/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ pub trait Deque<T> : MutableSeq<T> {
492492
/// d.push_back(2i);
493493
/// assert_eq!(d.front(), Some(&1i));
494494
/// ```
495+
#[deprecated = "use the `push` method"]
495496
fn push_back(&mut self, elt: T);
496497

497498
/// Remove the last element and return it, or `None` if the sequence is empty.
@@ -509,6 +510,7 @@ pub trait Deque<T> : MutableSeq<T> {
509510
/// assert_eq!(d.pop_back(), Some(1i));
510511
/// assert_eq!(d.pop_back(), None);
511512
/// ```
513+
#[deprecated = "use the `pop` method"]
512514
fn pop_back(&mut self) -> Option<T>;
513515

514516
/// Remove the first element and return it, or `None` if the sequence is empty.

src/libcollections/ringbuf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ impl<T> Deque<T> for RingBuf<T> {
8181
}
8282

8383
/// Remove and return the last element in the RingBuf, or None if it is empty
84+
#[deprecated = "use the `pop` method"]
8485
fn pop_back(&mut self) -> Option<T> {
8586
if self.nelts > 0 {
8687
self.nelts -= 1;
@@ -104,6 +105,7 @@ impl<T> Deque<T> for RingBuf<T> {
104105
}
105106

106107
/// Append an element to the RingBuf
108+
#[deprecated = "use the `push` method"]
107109
fn push_back(&mut self, t: T) {
108110
if self.nelts == self.elts.len() {
109111
grow(self.nelts, &mut self.lo, &mut self.elts);

0 commit comments

Comments
 (0)