Added a get function to IndexMap
This commit is contained in:
@@ -62,6 +62,14 @@ where
|
|||||||
Self(HashMap::new())
|
Self(HashMap::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<Index>
|
||||||
|
where
|
||||||
|
K: Borrow<Q>,
|
||||||
|
Q: Hash + Eq + ToOwned<Owned = K>,
|
||||||
|
{
|
||||||
|
self.0.get(k).cloned()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_or_create<Q: ?Sized>(&mut self, k: &Q) -> Index
|
pub fn get_or_create<Q: ?Sized>(&mut self, k: &Q) -> Index
|
||||||
where
|
where
|
||||||
K: Borrow<Q>,
|
K: Borrow<Q>,
|
||||||
|
|||||||
Reference in New Issue
Block a user