diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2023-01-07 14:38:21 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2023-01-07 14:38:21 +0000 |
| commit | fed349957dc774b4f5f614e030fe61304e9325f8 (patch) | |
| tree | cdc7dd3442f2ae55aeeb95c340c990a149ff5237 | |
| parent | d72b7d2d2a64f5f77b919a1428873b4d4149f60d (diff) | |
| download | rust-fed349957dc774b4f5f614e030fe61304e9325f8.tar.gz rust-fed349957dc774b4f5f614e030fe61304e9325f8.zip | |
Clarify examples for `VecDeque::get/get_mut`
| -rw-r--r-- | library/alloc/src/collections/vec_deque/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index c955db46d29..1b576521a91 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -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")] @@ -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")] |
