{"id":20428921,"url":"https://github.com/ppmathis/const-enum","last_synced_at":"2025-07-24T06:06:54.077Z","repository":{"id":142898981,"uuid":"442566329","full_name":"ppmathis/const-enum","owner":"ppmathis","description":"Constant From trait implementation for Rust enums with repr type","archived":false,"fork":false,"pushed_at":"2021-12-28T19:47:51.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-05T05:30:47.245Z","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/ppmathis.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":"2021-12-28T19:40:11.000Z","updated_at":"2021-12-28T19:46:38.000Z","dependencies_parsed_at":"2023-03-16T06:30:35.206Z","dependency_job_id":null,"html_url":"https://github.com/ppmathis/const-enum","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ppmathis/const-enum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmathis%2Fconst-enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmathis%2Fconst-enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmathis%2Fconst-enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmathis%2Fconst-enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppmathis","download_url":"https://codeload.github.com/ppmathis/const-enum/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppmathis%2Fconst-enum/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266801512,"owners_count":23986372,"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-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":"2024-11-15T07:29:26.574Z","updated_at":"2025-07-24T06:06:54.045Z","avatar_url":"https://github.com/ppmathis.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# const-enum\n\n[![GitHub](https://img.shields.io/static/v1?label=GitHub\u0026message=const-enum\u0026style=for-the-badge\u0026logo=github\u0026logoColor=white\u0026color=informational)](https://github.com/ppmathis/const-enum)\n[![Crates.io](https://img.shields.io/crates/v/const-enum?style=for-the-badge\u0026logo=rust\u0026logoColor=white\u0026color=informational)](https://crates.io/crates/const-enum)\n[![docs.rs](https://img.shields.io/docsrs/const-enum?style=for-the-badge\u0026label=docs.rs\u0026logo=rust\u0026logoColor=white\u0026color=informational)](https://docs.rs/const-enum)\n[![GitHub Actions Status](https://img.shields.io/github/workflow/status/ppmathis/const-enum/CI/main?style=for-the-badge\u0026logo=githubactions\u0026logoColor=white)](https://github.com/ppmathis/const-enum/actions)\n\nThis crate providers a procedural derive macro `ConstEnum`, which will provide a `const` implementation of the `From`\ntrait for converting an `enum` based on their `repr` type.\n\nUnfortunately Rust Stable does not currently contain all required features for implementing this crate.\nTo use of this library, you must use a recent Rust Nightly release and add the following feature flags to your crate root:\n\n```rust\n#![feature(const_trait_impl)]   // always required\n```\n\nHere is a simple example of how this library can be used:\n\n```rust\n#![feature(const_trait_impl)]\n\nuse const_enum::ConstEnum;\n\n#[derive(Copy, Clone, Debug, Eq, PartialEq, ConstEnum)]\n#[repr(u8)]\nenum Test {\n    A = 0b010,\n    B = 0b100,\n    C = 0b001\n}\n\npub fn main() {\n    println!(\"{:?}\", Test::from(0b010 as u8));\n    println!(\"{:?}\", u8::from(Test::A));\n}\n```\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppmathis%2Fconst-enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppmathis%2Fconst-enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppmathis%2Fconst-enum/lists"}