{"id":21666912,"url":"https://github.com/splurf/implhm","last_synced_at":"2025-03-20T06:47:54.448Z","repository":{"id":62444417,"uuid":"487458452","full_name":"splurf/implhm","owner":"splurf","description":"Simplified library of collision-handling HashMaps","archived":false,"fork":false,"pushed_at":"2022-05-19T18:43:07.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T07:04:43.546Z","etag":null,"topics":["collision-handling","data-structures","hashmap"],"latest_commit_sha":null,"homepage":"","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/splurf.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}},"created_at":"2022-05-01T06:00:27.000Z","updated_at":"2022-05-02T05:37:45.000Z","dependencies_parsed_at":"2022-11-01T22:01:45.995Z","dependency_job_id":null,"html_url":"https://github.com/splurf/implhm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splurf%2Fimplhm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splurf%2Fimplhm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splurf%2Fimplhm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splurf%2Fimplhm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splurf","download_url":"https://codeload.github.com/splurf/implhm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244566931,"owners_count":20473451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["collision-handling","data-structures","hashmap"],"created_at":"2024-11-25T11:30:30.513Z","updated_at":"2025-03-20T06:47:54.417Z","avatar_url":"https://github.com/splurf.png","language":"Rust","readme":"# implhm\n\n##### Simplified library of *collision-handling* **HashMaps**\n\n## Getting Started\nPlace *implhm* in your `Cargo.toml`:\n```toml\n[dependencies]\nimplhm = \"1.0.8\"\n```\n\n## Features\nThere are several different methods for handling collision. *implhm* provides the most basic implementations. The following features are available:\n\n+ **separate-chaining** (*default*)\n+ **open-addressing**\n    + *double-hashing*\n    + *linear-probing*\n    + *quadratic-probing*\n+ **separate-chaining-test**\n+ **open-addressing-test**\n    + *double-hashing-test*\n    + *linear-probing-test*\n    + *quadratic-probing-test*\n\nHere is an example of using a single feature:\n```toml\n[dependencies]\nimplhm = { version = \"1.0.8\", default-features = false, features = [\"quadratic-probing\"] }\n```\n\n## Usage\nA basic example of hash collision using two strings:\n```rust\nuse std::{\n    collections::hash_map::DefaultHasher,\n    hash::{Hash, Hasher},\n};\n\nfn hash\u003cT: Hash\u003e(key: T) -\u003e u64 {\n    let mut state = DefaultHasher::new();\n    key.hash(\u0026mut state);\n    state.finish() % 17\n}\n\nfn main() {\n    /*\n        When passed through the `hash` function,\n        `orange` and `blueberry` both equal `8`\n    */\n    let a = hash(\"orange\");\n    let b = hash(\"blueberry\");\n    /*\n        If *collision* isn't handled, then the *value*\n        (\"orange\") at the location of the *key* (`8`)\n        would be replaced with the *value* (\"blueberry\")\n    */\n    assert_eq!(a, b)\n}\n```\nHere, collision is completely handled by *separate chaining*:\n```rust\nuse implhm::{Map, MapMut, SCHashMap};\n\nfn main() {\n    let mut map = SCHashMap::default();\n\n    map.insert(\"orange\", \"ORANGE\");\n    map.insert(\"blueberry\", \"BLUEBERRY\");\n    /*\n        In the case of *separate chaining*, collision is\n        handled by placing any key-pairs that calculate to\n        the same hash into an ordered list at that index.\n    */\n    assert_eq!(map.get(\"orange\"), Some(\u0026\"ORANGE\"));\n    assert_eq!(map.get(\"blueberry\"), Some(\u0026\"BLUEBERRY\"));\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplurf%2Fimplhm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplurf%2Fimplhm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplurf%2Fimplhm/lists"}