collections: Deprecate push_back/pop_back
This commit is contained in:
parent
d36a8f3f9c
commit
79a980558b
@ -253,6 +253,7 @@ impl<T> Deque<T> for DList<T> {
|
||||
/// Add an element last in the list
|
||||
///
|
||||
/// O(1)
|
||||
#[deprecated = "use the `push` method"]
|
||||
fn push_back(&mut self, elt: T) {
|
||||
self.push_back_node(box Node::new(elt))
|
||||
}
|
||||
@ -260,6 +261,7 @@ impl<T> Deque<T> for DList<T> {
|
||||
/// Remove the last element and return it, or None if the list is empty
|
||||
///
|
||||
/// O(1)
|
||||
#[deprecated = "use the `pop` method"]
|
||||
fn pop_back(&mut self) -> Option<T> {
|
||||
self.pop_back_node().map(|box Node{value, ..}| value)
|
||||
}
|
||||
|
@ -492,6 +492,7 @@ pub trait Deque<T> : MutableSeq<T> {
|
||||
/// d.push_back(2i);
|
||||
/// assert_eq!(d.front(), Some(&1i));
|
||||
/// ```
|
||||
#[deprecated = "use the `push` method"]
|
||||
fn push_back(&mut self, elt: T);
|
||||
|
||||
/// Remove the last element and return it, or `None` if the sequence is empty.
|
||||
@ -509,6 +510,7 @@ pub trait Deque<T> : MutableSeq<T> {
|
||||
/// assert_eq!(d.pop_back(), Some(1i));
|
||||
/// assert_eq!(d.pop_back(), None);
|
||||
/// ```
|
||||
#[deprecated = "use the `pop` method"]
|
||||
fn pop_back(&mut self) -> Option<T>;
|
||||
|
||||
/// Remove the first element and return it, or `None` if the sequence is empty.
|
||||
|
@ -81,6 +81,7 @@ impl<T> Deque<T> for RingBuf<T> {
|
||||
}
|
||||
|
||||
/// Remove and return the last element in the RingBuf, or None if it is empty
|
||||
#[deprecated = "use the `pop` method"]
|
||||
fn pop_back(&mut self) -> Option<T> {
|
||||
if self.nelts > 0 {
|
||||
self.nelts -= 1;
|
||||
@ -104,6 +105,7 @@ impl<T> Deque<T> for RingBuf<T> {
|
||||
}
|
||||
|
||||
/// Append an element to the RingBuf
|
||||
#[deprecated = "use the `push` method"]
|
||||
fn push_back(&mut self, t: T) {
|
||||
if self.nelts == self.elts.len() {
|
||||
grow(self.nelts, &mut self.lo, &mut self.elts);
|
||||
|
Loading…
x
Reference in New Issue
Block a user