Skip to content

Commit

Permalink
Rollup merge of #106562 - clubby789:vec-deque-example, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Clarify examples for `VecDeque::get/get_mut`

Closes #106114

``@rustbot`` label +A-docs
  • Loading branch information
Yuki Okushi committed Jan 8, 2023
2 parents 3b5afa5 + fed3499 commit 14ce603
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// buf.push_back(3);
/// buf.push_back(4);
/// buf.push_back(5);
/// buf.push_back(6);
/// assert_eq!(buf.get(1), Some(&4));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -661,10 +662,11 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// buf.push_back(3);
/// buf.push_back(4);
/// buf.push_back(5);
/// buf.push_back(6);
/// assert_eq!(buf[1], 4);
/// if let Some(elem) = buf.get_mut(1) {
/// *elem = 7;
/// }
///
/// assert_eq!(buf[1], 7);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down

0 comments on commit 14ce603

Please sign in to comment.