{"id":33934676,"url":"https://github.com/imartayan/mashmap","last_synced_at":"2026-04-05T01:31:37.974Z","repository":{"id":237653752,"uuid":"794973016","full_name":"imartayan/mashmap","owner":"imartayan","description":"A flat HashMap that supports multiple entries per key","archived":false,"fork":false,"pushed_at":"2025-06-24T15:48:50.000Z","size":54,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-02T20:58:19.539Z","etag":null,"topics":["flat","hashmap","multimap","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/mashmap","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imartayan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-02T10:30:53.000Z","updated_at":"2025-06-30T19:32:57.000Z","dependencies_parsed_at":"2024-05-07T14:38:11.645Z","dependency_job_id":null,"html_url":"https://github.com/imartayan/mashmap","commit_stats":null,"previous_names":["imartayan/mashmap"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/imartayan/mashmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imartayan%2Fmashmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imartayan%2Fmashmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imartayan%2Fmashmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imartayan%2Fmashmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imartayan","download_url":"https://codeload.github.com/imartayan/mashmap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imartayan%2Fmashmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31421869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flat","hashmap","multimap","rust"],"created_at":"2025-12-12T13:53:15.618Z","updated_at":"2026-04-05T01:31:37.965Z","avatar_url":"https://github.com/imartayan.png","language":"Rust","readme":"# MashMap\n\n[![crates.io](https://img.shields.io/crates/v/mashmap)](https://crates.io/crates/mashmap)\n[![docs](https://img.shields.io/docsrs/mashmap)](https://docs.rs/mashmap)\n\nA flat HashMap that supports multiple entries per key.\n\nThis is an adaptation of Rust's standard `HashMap` (using [hashbrown](https://github.com/rust-lang/hashbrown)'s [`RawTable`](https://docs.rs/hashbrown/0.14.5/hashbrown/raw/struct.RawTable.html)) to support multiple entries with the same key.\nWhile a common approach is to use a `HashMap\u003cK, Vec\u003cV\u003e\u003e` to store the entries corresponding to a key in a `Vec`, `MashMap` keeps a flat layout and stores all entries in the same table using probing to select the slots.\nThis approach avoids the memory indirection caused by vector pointers, and reduces memory overhead since it avoids storing the pointer + length + capacity of a vector for each key.\n\n## Example usage\n\n```rust\nuse mashmap::MashMap;\n\nlet mut map = MashMap::\u003cusize, usize\u003e::new();\nmap.insert(1, 10);\nmap.insert(1, 11);\nmap.insert(1, 12);\nmap.insert(2, 20);\nmap.insert(2, 21);\n\n// iterate over the values with key `1` with mutable references and increment them\nfor val in map.get_mut_iter(\u00261) {\n    *val += 1;\n}\n\n// collect the values with keys `1` and `2`\n// note that the order may differ from the insertion order\nlet mut values_1: Vec\u003c_\u003e = map.get_iter(\u00261).copied().collect();\nlet mut values_2: Vec\u003c_\u003e = map.get_iter(\u00262).copied().collect();\nvalues_1.sort_unstable();\nvalues_2.sort_unstable();\n\nassert_eq!(values_1, vec![11, 12, 13]);\nassert_eq!(values_2, vec![20, 21]);\n```\n\n## Acknowledgement\n\nThis crate was inspired by the [flat-multimap](https://crates.io/crates/flat-multimap) crate which does not have a public repository anymore.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimartayan%2Fmashmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimartayan%2Fmashmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimartayan%2Fmashmap/lists"}