Skip to content

Commit

Permalink
Docs and minor style change for Arena::get2_mut
Browse files Browse the repository at this point in the history
  • Loading branch information
lynzrand committed Feb 11, 2021
1 parent 3b1f880 commit 356ab82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased Changes
* Implemented `IntoIterator` for `&Arena` and `&mut Arena`.
* Added `Arena::get2_mut` for getting two mutable references of different slots at once.

## 0.4.0 (2020-11-17)
* Added `Index::slot` for extracting the slot portion of an index.
Expand Down
9 changes: 5 additions & 4 deletions src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ impl<T> Arena<T> {
}
}

/// Get mutable references to two values inside this arena at once by
/// [`Index`], returning `None` if the corresponding index is not contained
/// in this arena.
/// Get mutable references of two values inside this arena at once by
/// [`Index`], returning `None` if the corresponding `index` is not
/// contained in this arena.
///
/// # Panics
///
Expand All @@ -234,7 +234,8 @@ impl<T> Arena<T> {
panic!("Arena::get2_mut is called with two identical indices");
}

// Unsafe notes:
// SAFETY NOTES:
//
// - If `index1` and `index2` have different slot number, `item1` and
// `item2` would point to different elements.
// - If `index1` and `index2` have the same slot number, only one could
Expand Down

0 comments on commit 356ab82

Please sign in to comment.