Skip to content

Commit 039c9b5

Browse files
committed
move CursorMut declaration closer to impl
1 parent c6097a7 commit 039c9b5

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/linked_hash_map.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,27 +1408,6 @@ pub struct Drain<'a, K, V> {
14081408
marker: PhantomData<(K, V, &'a LinkedHashMap<K, V>)>,
14091409
}
14101410

1411-
/// The `CursorMut` struct and its implementation provide the basic mutable Cursor API for Linked
1412-
/// lists as proposed in
1413-
/// [here](https://github.com/rust-lang/rfcs/blob/master/text/2570-linked-list-cursors.md), with
1414-
/// several exceptions:
1415-
///
1416-
/// - It behaves similarly to Rust's Iterators, returning `None` when the end of the list is
1417-
/// reached. A _guard_ node is positioned between the head and tail of the linked list to
1418-
/// facilitate this. If the cursor is over this guard node, `None` is returned, signaling the end
1419-
/// or start of the list. From this position, the cursor can move in either direction as the
1420-
/// linked list is circular, with the guard node connecting the two ends.
1421-
/// - The current implementation does not include an `index` method, as it does not track the index
1422-
/// of its elements. It provides access to each map entry as a tuple of `(&K, &mut V)`.
1423-
///
1424-
pub struct CursorMut<'a, K, V, S> {
1425-
cur: *mut Node<K, V>,
1426-
hash_builder: &'a S,
1427-
free: &'a mut Option<NonNull<Node<K, V>>>,
1428-
values: &'a mut Option<NonNull<Node<K, V>>>,
1429-
table: &'a mut hashbrown::HashTable<NonNull<Node<K, V>>>,
1430-
}
1431-
14321411
impl<K, V> IterMut<'_, K, V> {
14331412
#[inline]
14341413
pub(crate) fn iter(&self) -> Iter<'_, K, V> {
@@ -1762,6 +1741,27 @@ impl<'a, K, V> Drop for Drain<'a, K, V> {
17621741
}
17631742
}
17641743

1744+
/// The `CursorMut` struct and its implementation provide the basic mutable Cursor API for Linked
1745+
/// lists as proposed in
1746+
/// [here](https://github.com/rust-lang/rfcs/blob/master/text/2570-linked-list-cursors.md), with
1747+
/// several exceptions:
1748+
///
1749+
/// - It behaves similarly to Rust's Iterators, returning `None` when the end of the list is
1750+
/// reached. A _guard_ node is positioned between the head and tail of the linked list to
1751+
/// facilitate this. If the cursor is over this guard node, `None` is returned, signaling the end
1752+
/// or start of the list. From this position, the cursor can move in either direction as the
1753+
/// linked list is circular, with the guard node connecting the two ends.
1754+
/// - The current implementation does not include an `index` method, as it does not track the index
1755+
/// of its elements. It provides access to each map entry as a tuple of `(&K, &mut V)`.
1756+
///
1757+
pub struct CursorMut<'a, K, V, S> {
1758+
cur: *mut Node<K, V>,
1759+
hash_builder: &'a S,
1760+
free: &'a mut Option<NonNull<Node<K, V>>>,
1761+
values: &'a mut Option<NonNull<Node<K, V>>>,
1762+
table: &'a mut hashbrown::HashTable<NonNull<Node<K, V>>>,
1763+
}
1764+
17651765
impl<'a, K, V, S> CursorMut<'a, K, V, S> {
17661766
/// Returns an `Option` of the current element in the list, provided it is not the
17671767
/// _guard_ node, and `None` overwise.

0 commit comments

Comments
 (0)