File tree Expand file tree Collapse file tree 2 files changed +23
-23
lines changed
Expand file tree Collapse file tree 2 files changed +23
-23
lines changed Original file line number Diff line number Diff line change @@ -326,7 +326,30 @@ pub trait MutableSet<T>: Set<T> + Mutable {
326326}
327327
328328pub trait MutableSeq < T > : Mutable {
329+ /// Append an element to the back of a collection.
330+ ///
331+ /// # Failure
332+ ///
333+ /// Fails if the number of elements in the vector overflows a `uint`.
334+ ///
335+ /// # Example
336+ ///
337+ /// ```rust
338+ /// let mut vec = vec!(1i, 2);
339+ /// vec.push(3);
340+ /// assert_eq!(vec, vec!(1, 2, 3));
341+ /// ```
329342 fn push ( & mut self , t : T ) ;
343+ /// Remove the last element from a collection and return it, or `None` if it is
344+ /// empty.
345+ ///
346+ /// # Example
347+ ///
348+ /// ```rust
349+ /// let mut vec = vec!(1i, 2, 3);
350+ /// assert_eq!(vec.pop(), Some(3));
351+ /// assert_eq!(vec, vec!(1, 2));
352+ /// ```
330353 fn pop ( & mut self ) -> Option < T > ;
331354}
332355
Original file line number Diff line number Diff line change @@ -1555,19 +1555,6 @@ impl<T:fmt::Show> fmt::Show for Vec<T> {
15551555}
15561556
15571557impl < T > MutableSeq < T > for Vec < T > {
1558- /// Append an element to a vector.
1559- ///
1560- /// # Failure
1561- ///
1562- /// Fails if the number of elements in the vector overflows a `uint`.
1563- ///
1564- /// # Example
1565- ///
1566- /// ```rust
1567- /// let mut vec = vec!(1i, 2);
1568- /// vec.push(3);
1569- /// assert_eq!(vec, vec!(1, 2, 3));
1570- /// ```
15711558 #[ inline]
15721559 fn push ( & mut self , value : T ) {
15731560 if mem:: size_of :: < T > ( ) == 0 {
@@ -1594,16 +1581,6 @@ impl<T> MutableSeq<T> for Vec<T> {
15941581 }
15951582 }
15961583
1597- /// Remove the last element from a vector and return it, or `None` if it is
1598- /// empty.
1599- ///
1600- /// # Example
1601- ///
1602- /// ```rust
1603- /// let mut vec = vec!(1i, 2, 3);
1604- /// assert_eq!(vec.pop(), Some(3));
1605- /// assert_eq!(vec, vec!(1, 2));
1606- /// ```
16071584 #[ inline]
16081585 fn pop ( & mut self ) -> Option < T > {
16091586 if self . len == 0 {
You can’t perform that action at this time.
0 commit comments