1use indexmap::IndexMap;
2
3pub fn sortmap<K: std::cmp::Ord + std::hash::Hash, V>(mut li: Vec<(K, V)>) -> IndexMap<K, V> {
4 let mut t = IndexMap::new();
5 li.sort_by(|a, b| a.0.cmp(&b.0));
6 for (key, value) in li {
7 t.insert(key, value);
8 }
9 t
10}