Skip to content

Commit

Permalink
Add remark and an example about the bounds of Vec::insert
Browse files Browse the repository at this point in the history
  • Loading branch information
tbu- committed Jun 28, 2014
1 parent 8fe47bc commit a208842
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcollections/vec.rs
Expand Up @@ -956,14 +956,17 @@ impl<T> Vec<T> {
///
/// # Failure
///
/// Fails if `index` is out of bounds of the vector.
/// Fails if `index` is not between `0` and the vector's length (both
/// bounds inclusive).
///
/// # Example
///
/// ```rust
/// let mut vec = vec!(1i, 2, 3);
/// vec.insert(1, 4);
/// assert_eq!(vec, vec!(1, 4, 2, 3));
/// vec.insert(4, 5);
/// assert_eq!(vec, vec!(1, 4, 2, 3, 5));
/// ```
pub fn insert(&mut self, index: uint, element: T) {
let len = self.len();
Expand Down

9 comments on commit a208842

@bors
Copy link
Contributor

@bors bors commented on a208842 Jun 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at tbu-@a208842

@bors
Copy link
Contributor

@bors bors commented on a208842 Jun 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging tbu-/rust/pr_doc_vecinsert = a208842 into auto

@bors
Copy link
Contributor

@bors bors commented on a208842 Jun 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbu-/rust/pr_doc_vecinsert = a208842 merged ok, testing candidate = b7c9d38e

@bors
Copy link
Contributor

@bors bors commented on a208842 Jun 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at tbu-@a208842

@bors
Copy link
Contributor

@bors bors commented on a208842 Jun 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging tbu-/rust/pr_doc_vecinsert = a208842 into auto

@bors
Copy link
Contributor

@bors bors commented on a208842 Jun 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbu-/rust/pr_doc_vecinsert = a208842 merged ok, testing candidate = b47f222

@bors
Copy link
Contributor

@bors bors commented on a208842 Jun 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = b47f222

Please sign in to comment.