diff options
Diffstat (limited to 'src/libcollections')
| -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 { |
