Skip to content

Commit 697f84d

Browse files
committed
f
1 parent 67571af commit 697f84d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lightning/src/util/indexed_map.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ use core::ops::RangeBounds;
66

77
/// A map which can be iterated in a deterministic order.
88
///
9-
/// This would traditionally be accomplished by simply using a `BTreeMap`, however B-Trees
9+
/// This would traditionally be accomplished by simply using a [`BTreeMap`], however B-Trees
1010
/// generally have very slow lookups. Because we use a nodes+channels map while finding routes
1111
/// across the network graph, our network graph backing map must be as performant as possible.
1212
/// However, because peers expect to sync the network graph from us (and we need to support that
1313
/// without holding a lock on the graph for the duration of the sync or dumping the entire graph
1414
/// into our outbound message queue), we need an iterable map with a consistent iteration order we
1515
/// can jump to a starting point on.
1616
///
17-
/// Thus, we have a custom data structure here - its API mimics that of Rust's `BTreeMap`, but is
17+
/// Thus, we have a custom data structure here - its API mimics that of Rust's [`BTreeMap`], but is
1818
/// actually backed by a [`HashMap`], with some additional tracking to ensure we can iterate over
1919
/// keys in the order defined by [`Ord`].
20+
///
21+
/// [`BTreeMap`]: alloc::collections::BTreeMap
2022
#[derive(Clone, PartialEq, Eq)]
2123
pub struct IndexedMap<K: Ord, V> {
2224
map: BTreeMap<K, V>,

0 commit comments

Comments
 (0)