{"id":16330635,"url":"https://github.com/jeltef/defaultmap","last_synced_at":"2025-09-05T06:36:01.944Z","repository":{"id":55025217,"uuid":"89060323","full_name":"JelteF/defaultmap","owner":"JelteF","description":"A defaultmap for rust","archived":false,"fork":false,"pushed_at":"2025-04-21T21:13:25.000Z","size":71,"stargazers_count":23,"open_issues_count":5,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-30T03:40:22.567Z","etag":null,"topics":["counter","datastructure","defaultdict","defaultmap","hashmap","rust"],"latest_commit_sha":null,"homepage":null,"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/JelteF.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2017-04-22T09:58:09.000Z","updated_at":"2025-04-21T21:13:29.000Z","dependencies_parsed_at":"2024-10-10T23:24:07.659Z","dependency_job_id":"2b94e165-e02e-46cf-ab1e-b6509dbbe74a","html_url":"https://github.com/JelteF/defaultmap","commit_stats":{"total_commits":83,"total_committers":6,"mean_commits":"13.833333333333334","dds":0.07228915662650603,"last_synced_commit":"d32b14d60d76fbe145151c205c5647bd388edbd6"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/JelteF/defaultmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelteF%2Fdefaultmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelteF%2Fdefaultmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelteF%2Fdefaultmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelteF%2Fdefaultmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JelteF","download_url":"https://codeload.github.com/JelteF/defaultmap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelteF%2Fdefaultmap/sbom","scorecard":{"id":72030,"data":{"date":"2025-08-11","repo":{"name":"github.com/JelteF/defaultmap","commit":"f21ff757f962076aa285b482222456fea36ae4d2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:63: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:88: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:93: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:98: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:102: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:103: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:122: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:143: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:144: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:157: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:158: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:183: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:199: update your workflow using https://app.stepsecurity.io/secureworkflow/JelteF/defaultmap/ci.yml/master?enable=pin","Warn: downloadThenRun not pinned by hash: ci/install.sh:19","Info:   0 out of  10 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   9 third-party GitHubAction dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T04:00:03.535Z","repository_id":55025217,"created_at":"2025-08-15T04:00:03.535Z","updated_at":"2025-08-15T04:00:03.535Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273723196,"owners_count":25156302,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["counter","datastructure","defaultdict","defaultmap","hashmap","rust"],"created_at":"2024-10-10T23:24:05.364Z","updated_at":"2025-09-05T06:36:01.920Z","avatar_url":"https://github.com/JelteF.png","language":"Rust","readme":"# defaultmap\n\n[![Build Status](https://github.com/JelteF/defaultmap/workflows/CI/badge.svg)](https://github.com/JelteF/defaultmap/actions)\n[![codecov](https://codecov.io/gh/JelteF/defaultmap/branch/master/graph/badge.svg)](https://codecov.io/gh/JelteF/defaultmap)\n[![Latest Version](https://img.shields.io/crates/v/defaultmap.svg)](https://crates.io/crates/defaultmap)\n[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/defaultmap/)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/JelteF/defaultmap/master/LICENSE)\n\n\nIt can be useful to not have to worry about missing keys in a map.\nIf a key is requested that doesn't have a value a default value is simply returned.\nThis is exactly what this library provides.\n\n## Examples\n\n### Counter\nA clear use case of this is when counting the unique elements in a list.\nHere you want to add one to the existing value in the map for that key.\nThis is a problem for the first addition when there's no value for the key yet.\nWith this library you can specify when creating the map that the default value should be zero.\n\n\n```rust\n# use defaultmap::*;\nlet nums = [1, 4, 3, 3, 4, 2, 4];\nlet mut counts:  DefaultHashMap\u003ci32, i32\u003e = DefaultHashMap::new(0);\n// DefaultHashMap::default() is equivalent.\n\nfor num in nums.into_iter() {\n    counts[*num] += 1;\n}\n\nprintln!(\"{:?}\", counts);\n// DefaultHashMap { map: {1: 1, 3: 2, 2: 1, 4: 3}, default: 0 }\n\n# assert_eq!(1, counts[1]);\n# assert_eq!(1, counts[2]);\n# assert_eq!(2, counts[3]);\n# assert_eq!(3, counts[4]);\n```\n\n\n### Synonym lists\n\nAnother way the default map can be used is using a map filled with other collections, such as a\na `Vec`, a `HashMap` or even another default map.\nNext follows some code to create a map where we start with tuples of synonyms and we end with a\nmap that contains the list of synonyms for each word.\n\n```rust\n# use defaultmap::*;\n\nlet synonym_tuples = [\n    (\"nice\", \"sweet\"),\n    (\"sweet\", \"candy\"),\n    (\"nice\", \"entertaining\"),\n    (\"nice\", \"good\"),\n    (\"entertaining\", \"absorbing\"),\n];\n\nlet mut synonym_map: DefaultHashMap\u003c\u0026str, Vec\u003c\u0026str\u003e\u003e = DefaultHashMap::new(vec![]);\n// DefaultHashMap::default() is equivalent.\n\nfor \u0026(l, r) in synonym_tuples.into_iter() {\n    synonym_map[l].push(r);\n    synonym_map[r].push(l);\n}\n\nassert_eq!(synonym_map[\"good\"], vec![\"nice\"]);\nassert_eq!(synonym_map[\"nice\"], vec![\"sweet\", \"entertaining\", \"good\"]);\nassert_eq!(synonym_map[\"evil\"], Vec::\u003c\u0026str\u003e::new());\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeltef%2Fdefaultmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeltef%2Fdefaultmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeltef%2Fdefaultmap/lists"}