{"id":33939575,"url":"https://github.com/rust-cv/space","last_synced_at":"2025-12-12T15:38:19.692Z","repository":{"id":47335700,"uuid":"149939926","full_name":"rust-cv/space","owner":"rust-cv","description":"Spatial library for Rust","archived":false,"fork":false,"pushed_at":"2025-08-04T22:05:06.000Z","size":233,"stargazers_count":41,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-06T06:53:01.411Z","etag":null,"topics":[],"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/rust-cv.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":"2018-09-23T01:58:43.000Z","updated_at":"2025-08-07T00:40:14.000Z","dependencies_parsed_at":"2022-08-27T19:10:49.651Z","dependency_job_id":null,"html_url":"https://github.com/rust-cv/space","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/rust-cv/space","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fspace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fspace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fspace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fspace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-cv","download_url":"https://codeload.github.com/rust-cv/space/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fspace/sbom","scorecard":{"id":790458,"data":{"date":"2025-08-11","repo":{"name":"github.com/rust-cv/space","commit":"8d4d4023bc7c6a3b3aeae68d8afec2c4370ad30b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.5,"checks":[{"name":"Code-Review","score":2,"reason":"Found 2/9 approved changesets -- score normalized to 2","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":"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":9,"reason":"11 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"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:14: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:63: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/space/ci.yml/main?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction 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":"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":"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":"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":"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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 24 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-23T07:22:45.963Z","repository_id":47335700,"created_at":"2025-08-23T07:22:45.963Z","updated_at":"2025-08-23T07:22:45.963Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27685597,"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-12-12T02:00:06.775Z","response_time":129,"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":[],"created_at":"2025-12-12T15:38:18.628Z","updated_at":"2025-12-12T15:38:19.686Z","avatar_url":"https://github.com/rust-cv.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# space\n\n[![Discord][dci]][dcl] [![Crates.io][ci]][cl] ![MIT/Apache][li] [![docs.rs][di]][dl] ![LoC][lo] ![Tests][btl] ![Lints][bll] ![no_std][bnl]\n\n[ci]: https://img.shields.io/crates/v/space.svg\n[cl]: https://crates.io/crates/space/\n\n[li]: https://img.shields.io/crates/l/specs.svg?maxAge=2592000\n\n[di]: https://docs.rs/space/badge.svg\n[dl]: https://docs.rs/space/\n\n[lo]: https://tokei.rs/b1/github/rust-cv/space?category=code\n\n[dci]: https://img.shields.io/discord/550706294311485440.svg?logo=discord\u0026colorB=7289DA\n[dcl]: https://discord.gg/d32jaam\n\n[btl]: https://github.com/rust-cv/space/workflows/tests/badge.svg\n[bll]: https://github.com/rust-cv/space/workflows/lints/badge.svg\n[bnl]: https://github.com/rust-cv/space/workflows/no-std/badge.svg\n\nA library providing abstractions for spatial datastructures and search\n\nIf you use a kNN datastructure library and would like to have the `Knn`\ntrait implemented on its types natively, please raise an issue on that library.\nSimilarly, crates which define datapoints with specific distance metrics, and\nnot general linear algebra crates, can implement the `MetricPoint` trait.\n\nSee the [bitarray](https://crates.io/crates/bitarray) crate for an implementation\nof `MetricPoint` using hamming distance (with optional, though unstable, 512-bit\nSIMD support, and always-on 64-bit popcnt instruction support).\n\n## Usage Examples\n\nThis example shows how to use the LinearSearch and LinearContainer that come built-in by default. You would use third party containers similarly and can abstract over them using the traits like SpatialContainer and Knn.\n\n```rust\nuse pgat::ReferenceProxy;\nuse space::{Knn, LinearContainer, LinearSearch, Metric, SpatialContainer};\n\n#[derive(Copy, Clone, Default)]\nstruct Hamming;\n\nimpl Metric\u003cReferenceProxy\u003cu8\u003e\u003e for Hamming {\n    type Unit = u8;\n\n    fn distance(\u0026self, \u0026a: \u0026u8, \u0026b: \u0026u8) -\u003e Self::Unit {\n        (a ^ b).count_ones() as u8\n    }\n}\n\n// Use type aliases like below to get default proxy types (ReferenceView) on the container.\ntype Container = LinearContainer\u003cHamming, u8, u8\u003e;\ntype Search\u003c'a\u003e = LinearSearch\u003c'a, Hamming, u8, u8\u003e;\n\nlet data = [\n    (0b1010_1010, 12),\n    (0b1111_1111, 13),\n    (0b0000_0000, 14),\n    (0b1111_0000, 16),\n    (0b0000_1111, 10),\n];\n\nlet search = Search::new(Hamming, \u0026data);\n\nassert_eq!(\n    search.knn(\u00260b0101_0000, 3).as_slice(),\n    \u0026[\n        (2, \u0026data[2].0, \u0026data[2].1),\n        (2, \u0026data[3].0, \u0026data[3].1),\n        (6, \u0026data[0].0, \u0026data[0].1)\n    ]\n);\n\nlet mut search = Container::from_metric_and_iterator(Hamming, data);\n\nassert_eq!(\n    search.knn(\u00260b0101_0000, 3).as_slice(),\n    \u0026[\n        (2, \u0026data[2].0, \u0026data[2].1),\n        (2, \u0026data[3].0, \u0026data[3].1),\n        (6, \u0026data[0].0, \u0026data[0].1)\n    ]\n);\n\nsearch.insert(0b0101_0001, 8);\n\nassert_eq!(search.nn(\u00260b0101_0000), Some((1, \u00260b0101_0001, \u00268)));\n```\n\nFor an example on how to create a container, a great reference may be found in tests/ndarray.rs in the repository. For brevity it is omitted here, but it shows how to create a specialized structure that uses an Array2 as the storage mechanism for Array1 points.\n\n## Benchmarks\n\nTo run the benchmarks, use the following command:\n\n```bash\ncargo bench --all-features\n```\n\nIf you do not pass `--all-features`, the benchmark wont run. Due to [this issue](https://github.com/rust-lang/cargo/issues/2911), the SIMD feature must be enabled. Cargo offers no way to automatically bring the SIMD feature in for the benchmark, and thus it must be passed at the command line.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-cv%2Fspace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-cv%2Fspace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-cv%2Fspace/lists"}