{"id":16064396,"url":"https://github.com/yeslogic/unicode-general-category","last_synced_at":"2025-09-02T19:45:55.083Z","repository":{"id":36481670,"uuid":"226021729","full_name":"yeslogic/unicode-general-category","owner":"yeslogic","description":"Fast lookup of the Unicode General Category property for `char` in Rust.","archived":false,"fork":false,"pushed_at":"2024-10-30T01:49:24.000Z","size":75,"stargazers_count":16,"open_issues_count":0,"forks_count":6,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-30T03:59:02.382Z","etag":null,"topics":["general-category","rust","ucd","unicode"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yeslogic.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":"2019-12-05T05:16:37.000Z","updated_at":"2024-10-30T01:48:06.000Z","dependencies_parsed_at":"2024-06-20T23:24:30.693Z","dependency_job_id":"21b73406-c7cd-44d6-b41c-3cd4856b5dcd","html_url":"https://github.com/yeslogic/unicode-general-category","commit_stats":{"total_commits":26,"total_committers":3,"mean_commits":8.666666666666666,"dds":0.07692307692307687,"last_synced_commit":"da4619b7035ab734c60a8bfe996fbfac38c18aaf"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeslogic%2Funicode-general-category","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeslogic%2Funicode-general-category/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeslogic%2Funicode-general-category/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeslogic%2Funicode-general-category/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yeslogic","download_url":"https://codeload.github.com/yeslogic/unicode-general-category/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411234,"owners_count":20934653,"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":["general-category","rust","ucd","unicode"],"created_at":"2024-10-09T05:06:58.510Z","updated_at":"2025-04-05T23:08:49.341Z","avatar_url":"https://github.com/yeslogic.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"unicode-general-category\n========================\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/yeslogic/unicode-general-category/actions/workflows/ci.yml\"\u003e\n    \u003cimg src=\"https://github.com/yeslogic/unicode-general-category/actions/workflows/ci.yml/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://docs.rs/unicode-general-category\"\u003e\n    \u003cimg src=\"https://docs.rs/unicode-general-category/badge.svg\" alt=\"Documentation\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://crates.io/crates/unicode-general-category\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/v/unicode-general-category.svg\" alt=\"Version\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/unicode-16.0-informational\" alt=\"Unicode Version\"\u003e\n  \u003ca href=\"https://github.com/yeslogic/unicode-general-category/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/l/unicode-general-category.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\nFast lookup of the Unicode General Category property for `char` in Rust using\nUnicode 16.0 data. This crate is no-std compatible.\n\nUsage\n-----\n\n```rust\nuse unicode_general_category::{get_general_category, GeneralCategory};\n\nfn main() {\n    assert_eq!(get_general_category('A'), GeneralCategory::UppercaseLetter);\n}\n```\n\nPerformance \u0026 Implementation Notes\n----------------------------------\n\n[ucd-generate] is used to generate `tables.rs`. A build script (`build.rs`)\ncompiles this into a two level look up table. The look up time is constant as\nit is just indexing into two arrays.\n\nThe two level approach maps a code point to a block, then to a position within\na block. The allows the second level of block to be deduplicated, saving space.\nThe code is parameterised over the block size, which must be a power of 2. The\nvalue in the build script is optimal for the data set.\n\nThis approach trades off some space for faster lookups. The tables take up\nabout 45KiB. Benchmarks showed this approach to be ~5–10× faster than the\ntypical binary search approach.\n\nIt's possible there are further optimisations that could be made to eliminate\nsome runs of repeated values in the first level array.\n\n[ucd-generate]: https://github.com/yeslogic/ucd-generate\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeslogic%2Funicode-general-category","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeslogic%2Funicode-general-category","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeslogic%2Funicode-general-category/lists"}