X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Findexed_map.rs;h=97788ffe68acbd5f90d67bd501710c3b5942ce51;hb=59a8bd5d65f820c033617bb7dfe3b2903616f2d3;hp=d4c20f722154fe499c68a296c45f25d8dd55aff4;hpb=73da722d18af7b510711c405154d81c1c9458942;p=rust-lightning diff --git a/lightning/src/util/indexed_map.rs b/lightning/src/util/indexed_map.rs index d4c20f72..97788ffe 100644 --- a/lightning/src/util/indexed_map.rs +++ b/lightning/src/util/indexed_map.rs @@ -1,10 +1,8 @@ //! This module has a map which can be iterated in a deterministic order. See the [`IndexedMap`]. use crate::prelude::*; -use alloc::vec::Vec; use alloc::slice::Iter; use core::hash::Hash; -use core::cmp::Ord; use core::ops::{Bound, RangeBounds}; /// A map which can be iterated in a deterministic order. @@ -58,6 +56,11 @@ impl IndexedMap { self.map.get_mut(key) } + /// Fetches the key-value pair corresponding to the supplied key, if one exists. + pub fn get_key_value(&self, key: &K) -> Option<(&K, &V)> { + self.map.get_key_value(key) + } + #[inline] /// Returns true if an element with the given `key` exists in the map. pub fn contains_key(&self, key: &K) -> bool {