{"id":21812255,"url":"https://github.com/aecsocket/const-exhaustive","last_synced_at":"2026-01-27T13:32:07.834Z","repository":{"id":258684571,"uuid":"862952253","full_name":"aecsocket/const-exhaustive","owner":"aecsocket","description":"Enumerate all values of a type at compile time","archived":false,"fork":false,"pushed_at":"2024-11-28T22:01:13.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T20:04:16.623Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aecsocket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2024-09-25T13:17:10.000Z","updated_at":"2024-11-28T21:51:06.000Z","dependencies_parsed_at":"2024-10-20T18:04:57.038Z","dependency_job_id":null,"html_url":"https://github.com/aecsocket/const-exhaustive","commit_stats":null,"previous_names":["aecsocket/const-exhaustive"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aecsocket%2Fconst-exhaustive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aecsocket%2Fconst-exhaustive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aecsocket%2Fconst-exhaustive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aecsocket%2Fconst-exhaustive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aecsocket","download_url":"https://codeload.github.com/aecsocket/const-exhaustive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235669395,"owners_count":19026819,"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":[],"created_at":"2024-11-27T14:15:22.039Z","updated_at":"2025-10-08T01:31:34.460Z","avatar_url":"https://github.com/aecsocket.png","language":"Rust","readme":"# `const-exhaustive`\n\n[![crates.io](https://img.shields.io/crates/v/const-exhaustive.svg)](https://crates.io/crates/const-exhaustive)\n[![docs.rs](https://img.shields.io/docsrs/const-exhaustive)](https://docs.rs/const-exhaustive)\n\nEnumerate all values of a type at compile time.\n\n## Features\n\n- **All values of `T: Exhaustive` are stored in a [`GenericArray`]** - allowing you to access all\n  values at compile time, and in a const context.\n\n- **Composable with `core` types** - supports `[T; N]`, tuples up to arity 16, `Option\u003cT\u003e`, and\n  other types in `core`.\n\n- **`#[derive(Exhaustive)]`** - to implement it on your own types.\n\n- **`#![no_std]` and no `alloc`** - you can use it anywhere.\n\n[`GenericArray`]: https://docs.rs/generic-array/\n\n## Examples\n\n```rust\nuse const_exhaustive::Exhaustive;\n\n// there is 1 value of `()`\nassert_eq!([()], \u003c()\u003e::ALL.as_slice());\n\n// there are 2 values of `bool`\nassert_eq!([false, true], bool::ALL.as_slice());\n\n// works on types with generics\nassert_eq!(\n    [None, Some(false), Some(true)],\n    Option::\u003cbool\u003e::ALL.as_slice()\n);\n\n// write your own exhaustive types\n#[derive(Debug, Clone, Copy, PartialEq, Exhaustive)]\nenum Direction {\n    North,\n    South,\n    East,\n    West,\n}\n\nassert_eq!(\n    [\n        Direction::North,\n        Direction::South,\n        Direction::East,\n        Direction::West,\n    ],\n    Direction::ALL.as_slice()\n);\n\n// works on arbitrarily complex types\n#[derive(Debug, Clone, Copy, PartialEq, Exhaustive)]\nenum Complex {\n    Direction(Direction),\n    More {\n        foo: Option\u003cbool\u003e,\n        bar: (Result\u003cDirection, [bool; 4]\u003e),\n    },\n}\n```\n\n## Testing\n\nRun unit and doc tests:\n\n```bash\ncargo test\n```\n\nRun miri tests:\n\n```bash\ncargo +nightly miri test\n```\n\nTest generating docs:\n\n```bash\nRUSTDOCFLAGS=\"--cfg docsrs_dep\" cargo +nightly doc --workspace --all-features\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faecsocket%2Fconst-exhaustive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faecsocket%2Fconst-exhaustive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faecsocket%2Fconst-exhaustive/lists"}