use std::collections::{BTreeMap, HashMap}; use indexmap::IndexMap; #[napi] fn get_mapping() -> HashMap { let mut map = HashMap::new(); map.insert("a".to_string(), 101); map.insert("b".to_string(), 102); map } #[napi] fn sum_mapping(nums: HashMap) -> u32 { nums.into_values().sum() } #[napi] fn get_btree_mapping() -> BTreeMap { let mut map = BTreeMap::new(); map.insert("a".to_string(), 101); map.insert("b".to_string(), 102); map } #[napi] fn sum_btree_mapping(nums: BTreeMap) -> u32 { nums.into_values().sum() } #[napi] fn get_index_mapping() -> IndexMap { let mut map = IndexMap::new(); map.insert("a".to_string(), 101); map.insert("b".to_string(), 102); map } #[napi] fn sum_index_mapping(nums: IndexMap) -> u32 { nums.into_values().sum() } #[napi] fn indexmap_passthrough(fixture: IndexMap) -> IndexMap { fixture }