[−][src]Crate bidir_map
Bidirectional maps for Rust.
Examples
use bidir_map::{BidirMap, ByFirst, BySecond}; use std::default::Default; let mut map = BidirMap::new(); assert_eq!(map, Default::default()); map.insert(1, "a"); assert_eq!(map.get_by_first(&1), Some(&"a")); assert_eq!(map.get_by_first(&2), None); assert_eq!(map.get_by_second(&"a"), Some(&1)); assert_eq!(map.get_by_second(&"b"), None); assert_eq!(map[ByFirst(&1)], "a"); assert_eq!(map[BySecond(&"a")], 1); // These would panic: // map[ByFirst(&2)]; // map[BySecond(&"b")];
Macros
bidir_map |
Create a |
Structs
BidirMap |
A bidirectional map. |
ByFirst |
Wrapper type for getting second keys/values with first keys/values via |
BySecond |
Wrapper type for getting second keys/values with first keys/values via |
FirstColumn |
An iterator the first set of K/Vs in a |
Iter |
An iterator over the K/V pairs contained in a |
IterMut |
An iterator over mutable K/V pairs contained in a |
SecondColumn |
An iterator the second set of K/Vs in a |