{"id":33934209,"url":"https://github.com/deotimedev/checks","last_synced_at":"2026-05-30T22:31:21.314Z","repository":{"id":154069815,"uuid":"630532878","full_name":"deotimedev/checks","owner":"deotimedev","description":"Adds several compile-time checks for rust const generics.","archived":false,"fork":false,"pushed_at":"2023-05-17T17:55:05.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-14T01:09:10.225Z","etag":null,"topics":["const-generics","no-std","rust","rust-macro"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/checks","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deotimedev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-20T15:26:30.000Z","updated_at":"2023-05-05T02:32:48.000Z","dependencies_parsed_at":"2023-09-08T17:11:36.387Z","dependency_job_id":null,"html_url":"https://github.com/deotimedev/checks","commit_stats":null,"previous_names":["deotimedev/checks","deotimethegithubuser/checks"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deotimedev/checks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deotimedev%2Fchecks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deotimedev%2Fchecks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deotimedev%2Fchecks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deotimedev%2Fchecks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deotimedev","download_url":"https://codeload.github.com/deotimedev/checks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deotimedev%2Fchecks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33712579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"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":["const-generics","no-std","rust","rust-macro"],"created_at":"2025-12-12T13:30:02.782Z","updated_at":"2026-05-30T22:31:21.309Z","avatar_url":"https://github.com/deotimedev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# checks\nAdds several compile time checks for const generics.\n\nIdea was based off of [this reddit post](https://www.reddit.com/r/rust/comments/gt067a/implementing_a_trait_only_for_types_satisfying_a/).\n\n\n#### Note: This library requires use of the `#![feature(generic_const_exprs)]` flag.\n## Usage:\n```rust\n#![feature(generic_const_exprs)]\n\n/// Only allows for arguments of `C` to be alphabetic\nstruct AlphabeticTest\u003cconst C: char\u003e\nwhere \n    checks::char::Alphabetic\u003cC\u003e: checks::Passed;\n\n// All letters are alphabetic, check passes.\nlet pass = AlphabeticTest::\u003c'a'\u003e; // Compiles\nlet pass = AlphabeticTest::\u003c'B'\u003e; // Compiles\nlet pass = AlphabeticTest::\u003c'c'\u003e; // Compiles\n\n// Letters are not alphabetic, check fails.\nlet fail = AlphabeticTest::\u003c'1'\u003e; // Compile error!\nlet fail = AlphabeticTest::\u003c'\u0026'\u003e; // Compile error!\nlet fail = AlphabeticTest::\u003c'3'\u003e; // Compile error!\n```\n\nCustom checks can be implemented as well:\n```rust\nconst fn is_binary(num: u8) -\u003e bool { num == 0 || num == 1 }\nstruct BinaryOnly\u003cconst N: u8\u003e \nwhere\n    Check\u003c{ is_binary(N) }\u003e: Passed;\n\nlet pass = BinaryOnly::\u003c0\u003e; // Compiles\nlet pass = BinaryOnly::\u003c1\u003e; // Compiles\n\nlet fail = BinaryOnly::\u003c2\u003e; // Compiler error!\n```\n\nChecks can also be defined with the `check!` macro, which will\nalso generate documentation / tests for example input:\n```rust\ncheck! { u8 =\u003e\n    /// Matches all binary numbers (0, 1)\n    Binary(\n        passes: 0, 1\n        fails: 2, 3, 4\n    ): |N| (N == 0 || N == 1)\n}\n\nstruct BinaryOnly\u003cconst N: u8\u003e\nwhere\n    Binary\u003cN\u003e: Passed;\n\nlet pass = BinaryOnly::\u003c0\u003e; // Compiles\nlet pass = BinaryOnly::\u003c1\u003e; // Compiles\n\nlet fail = BinaryOnly::\u003c2\u003e; // Compiler error!\n```\n\nFull list of provided checks can be found on the [docs.rs page](https://docs.rs/checks/latest).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeotimedev%2Fchecks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeotimedev%2Fchecks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeotimedev%2Fchecks/lists"}