Skip to content

Commit

Permalink
Rollup merge of rust-lang#106562 - clubby789:vec-deque-example, r=Mar…
Browse files Browse the repository at this point in the history
…k-Simulacrum

Clarify examples for `VecDeque::get/get_mut`

Closes rust-lang#106114

`@rustbot` label +A-docs
  • Loading branch information
Yuki Okushi authored Jan 8, 2023
2 parents fddd27b + fed3499 commit bfbd959
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 bfbd959

Please sign in to comment.