diff options
| author | Brian Anderson <banderson@mozilla.com> | 2014-07-11 12:01:06 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2014-07-23 13:20:16 -0700 |
| commit | 7c61bb72130415006b505f12970b72bd96a7bc70 (patch) | |
| tree | 176fbc11a510512767b857d0fe47a2fe7c4e3aeb | |
| parent | 5599b69b6d3cb7ba9eb30b155aa580865b99d90e (diff) | |
| download | rust-7c61bb72130415006b505f12970b72bd96a7bc70.tar.gz rust-7c61bb72130415006b505f12970b72bd96a7bc70.zip | |
collections: Move push/pop docs to MutableSeq
| -rw-r--r-- | src/libcollections/lib.rs | 23 | ||||
| -rw-r--r-- | src/libcollections/vec.rs | 23 |
2 files changed, 23 insertions, 23 deletions
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 1cf660e0938..1d1907f4541 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -326,7 +326,30 @@ pub trait MutableSet<T>: Set<T> + Mutable { } pub trait MutableSeq<T>: Mutable { + /// Append an element to the back of a collection. + /// + /// # Failure + /// + /// Fails if the number of elements in the vector overflows a `uint`. + /// + /// # Example + /// + /// ```rust + /// let mut vec = vec!(1i, 2); + /// vec.push(3); + /// assert_eq!(vec, vec!(1, 2, 3)); + /// ``` fn push(&mut self, t: T); + /// Remove the last element from a collection and return it, or `None` if it is + /// empty. + /// + /// # Example + /// + /// ```rust + /// let mut vec = vec!(1i, 2, 3); + /// assert_eq!(vec.pop(), Some(3)); + /// assert_eq!(vec, vec!(1, 2)); + /// ``` fn pop(&mut self) -> Option<T>; } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 2338b5ff7e9..3c23550909b 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1555,19 +1555,6 @@ impl<T:fmt::Show> fmt::Show for Vec<T> { } impl<T> MutableSeq<T> for Vec<T> { - /// Append an element to a vector. - /// - /// # Failure - /// - /// Fails if the number of elements in the vector overflows a `uint`. - /// - /// # Example - /// - /// ```rust - /// let mut vec = vec!(1i, 2); - /// vec.push(3); - /// assert_eq!(vec, vec!(1, 2, 3)); - /// ``` #[inline] fn push(&mut self, value: T) { if mem::size_of::<T>() == 0 { @@ -1594,16 +1581,6 @@ impl<T> MutableSeq<T> for Vec<T> { } } - /// Remove the last element from a vector and return it, or `None` if it is - /// empty. - /// - /// # Example - /// - /// ```rust - /// let mut vec = vec!(1i, 2, 3); - /// assert_eq!(vec.pop(), Some(3)); - /// assert_eq!(vec, vec!(1, 2)); - /// ``` #[inline] fn pop(&mut self) -> Option<T> { if self.len == 0 { |
