]> git.lizzy.rs Git - rust.git/commitdiff
collections: Deprecate push_back/pop_back
authorBrian Anderson <banderson@mozilla.com>
Fri, 11 Jul 2014 17:19:27 +0000 (10:19 -0700)
committerBrian Anderson <banderson@mozilla.com>
Wed, 23 Jul 2014 20:20:16 +0000 (13:20 -0700)
src/libcollections/dlist.rs
src/libcollections/lib.rs
src/libcollections/ringbuf.rs

index 24df95e77c4806bae25f3b71da014715af6f89f3..f4d0763421c7616bc121a7ec23b34441044c3143 100644 (file)
@@ -253,6 +253,7 @@ fn pop_front(&mut self) -> Option<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 @@ fn push_back(&mut self, elt: 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)
     }
index 2b1d8b140ae5840cb2a15969a0deed4057cba8dd..1cf660e0938d1af1ec71d7bb36472a8a005c4208 100644 (file)
@@ -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.
index 05dda93039861aa0910c72380676b9dd27d39951..9d24b349c975c05afe47844a4158fee4c36e77bb 100644 (file)
@@ -81,6 +81,7 @@ fn pop_front(&mut self) -> Option<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 @@ fn push_front(&mut self, t: 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);