projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Relax OnionMessenger::peer_disconnected assertion
[rust-lightning]
/
lightning
/
src
/
util
/
indexed_map.rs
diff --git
a/lightning/src/util/indexed_map.rs
b/lightning/src/util/indexed_map.rs
index bb17d3450ee5ccb7193ebecd00583603071ba435..39565f048c07a25f30a6749b5057a55a15278664 100644
(file)
--- a/
lightning/src/util/indexed_map.rs
+++ b/
lightning/src/util/indexed_map.rs
@@
-39,6
+39,14
@@
impl<K: Clone + Hash + Ord, V> IndexedMap<K, V> {
}
}
}
}
+ /// Constructs a new, empty map with the given capacity pre-allocated
+ pub fn with_capacity(capacity: usize) -> Self {
+ Self {
+ map: HashMap::with_capacity(capacity),
+ keys: Vec::with_capacity(capacity),
+ }
+ }
+
#[inline(always)]
/// Fetches the element with the given `key`, if one exists.
pub fn get(&self, key: &K) -> Option<&V> {
#[inline(always)]
/// Fetches the element with the given `key`, if one exists.
pub fn get(&self, key: &K) -> Option<&V> {