Update crates and added methods to get a key or all keys in an IndexMap
This commit is contained in:
@@ -7,9 +7,9 @@ edition = "2021"
|
|||||||
approx = { version = "0.5.1", optional = true }
|
approx = { version = "0.5.1", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
plotters = { version = "0.3.1", default-features = false, features = ["svg_backend", "all_elements", "all_series"] }
|
plotters = { version = "0.3.4", default-features = false, features = ["svg_backend", "all_elements", "all_series"] }
|
||||||
plotters-backend = "0.3.2"
|
plotters-backend = "0.3.4"
|
||||||
time = { version = "0.3.9", features = ["parsing"] }
|
time = { version = "0.3.17", features = ["parsing"] }
|
||||||
trueskill-tt = { path = ".", features = ["approx"] }
|
trueskill-tt = { path = ".", features = ["approx"] }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
11
src/lib.rs
11
src/lib.rs
@@ -77,6 +77,17 @@ where
|
|||||||
idx
|
idx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn key(&self, idx: Index) -> Option<&K> {
|
||||||
|
self.0
|
||||||
|
.iter()
|
||||||
|
.find(|(_, &value)| value == idx)
|
||||||
|
.map(|(key, _)| key)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn keys(&self) -> impl Iterator<Item = &K> {
|
||||||
|
self.0.keys()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<K> Default for IndexMap<K>
|
impl<K> Default for IndexMap<K>
|
||||||
|
|||||||
Reference in New Issue
Block a user