I’m trying to create a map which uses tuples of
String as the keys, but use
&str to do the lookups for efficiency, but I can’t figure a way to do it:
let mut m: BTreeMap<(String,String),String> = BTreeMap::new(); ... let q = ("foo","bar"); m.get(&q);
I’ve tried creating structs with
String elements and ‘&str’ elements and implementing Borrow, but I haven’t been able to work that out.
I’ve got a workaround, which is just to have a map of maps for each
String in the tuple, but is there a better solution?