{"id":16009448,"url":"https://github.com/figsoda/one-of","last_synced_at":"2026-01-19T06:33:35.499Z","repository":{"id":43451374,"uuid":"314922572","full_name":"figsoda/one-of","owner":"figsoda","description":"Rust library that introduces macros to represent and use types that can be converted either From or TryInto the given types","archived":false,"fork":false,"pushed_at":"2023-09-05T00:34:59.000Z","size":32,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-20T12:44:38.309Z","etag":null,"topics":["data-structure","data-structures","enum","macro","macros","rust","type"],"latest_commit_sha":null,"homepage":"https://docs.rs/one-of","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/figsoda.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-11-21T23:26:35.000Z","updated_at":"2021-12-07T16:56:27.000Z","dependencies_parsed_at":"2024-10-27T16:14:03.066Z","dependency_job_id":"033a2e91-453a-4c1a-946a-98976fbc83f0","html_url":"https://github.com/figsoda/one-of","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":0.08163265306122447,"last_synced_commit":"f02e926fa16e6e63c245bf004c8667eccf709568"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/figsoda/one-of","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Fone-of","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Fone-of/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Fone-of/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Fone-of/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/figsoda","download_url":"https://codeload.github.com/figsoda/one-of/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figsoda%2Fone-of/sbom","scorecard":{"id":399238,"data":{"date":"2025-08-11","repo":{"name":"github.com/figsoda/one-of","commit":"f02e926fa16e6e63c245bf004c8667eccf709568"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/22 approved changesets -- score normalized to 0","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":"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":"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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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:11: update your workflow using https://app.stepsecurity.io/secureworkflow/figsoda/one-of/ci.yml/main?enable=pin","Info:   0 out of   1 GitHub-owned 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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Mozilla Public License 2.0: 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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 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-18T19:44:23.852Z","repository_id":43451374,"created_at":"2025-08-18T19:44:23.852Z","updated_at":"2025-08-18T19:44:23.852Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["data-structure","data-structures","enum","macro","macros","rust","type"],"created_at":"2024-10-08T13:02:12.919Z","updated_at":"2026-01-19T06:33:35.481Z","avatar_url":"https://github.com/figsoda.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# one-of\n\n[![version](https://img.shields.io/crates/v/one-of?logo=rust\u0026style=flat-square)](https://crates.io/crates/one-of)\n[![license](https://img.shields.io/badge/license-MPL--2.0-blue?style=flat-square)](https://www.mozilla.org/en-US/MPL/2.0)\n[![ci](https://img.shields.io/github/actions/workflow/status/figsoda/one-of/ci.yml?label=ci\u0026logo=github-actions\u0026style=flat-square)](https://github.com/figsoda/one-of/actions?query=workflow:ci)\n\nMacro to represent a type that can be converted either `From` or `TryInto` the given types\n\nThis crate only works on the nightly version of Rust\n\n[Documentation](https://docs.rs/one-of)\n\n\n## Usage\n\n```rust\nuse one_of::{case, one_of};\n\n// either `u32` or `char`\nlet x: one_of!(u32, char) = 42.into();\nassert_eq!(Some(42u32), x.into());\nassert_eq!(Option::\u003cchar\u003e::None, x.into());\n\n// some type of integer\nlet x: one_of!(i8, i16, i32, i64, u8, u16, u32, u64) = 42.into();\nassert_eq!(Option::\u003ci8\u003e::None, x.into());\nassert_eq!(Option::\u003ci16\u003e::None, x.into());\nassert_eq!(Some(42i32), x.into());\nassert_eq!(Option::\u003ci64\u003e::None, x.into());\nassert_eq!(Option::\u003cu8\u003e::None, x.into());\nassert_eq!(Option::\u003cu16\u003e::None, x.into());\nassert_eq!(Option::\u003cu32\u003e::None, x.into());\nassert_eq!(Option::\u003cu64\u003e::None, x.into());\n\n// case macro is the `match` keyword for `one_of` types\ncase!(\u003cone_of!(bool, \u0026str, i64)\u003e::from(\"Hello, world!\"),\n    // bool\n    _ =\u003e {\n        panic!(\"not bool\");\n    };\n\n    // \u0026str\n    s if s.starts_with(\"Hello, \") =\u003e {\n        assert_eq!(\u0026s[7 ..], \"world!\");\n    }\n    _ =\u003e {\n        panic!(\"not other strings\");\n    };\n\n    // i64\n    _ =\u003e {\n        panic!(\"not i64\");\n    };\n);\n```\n\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffigsoda%2Fone-of","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffigsoda%2Fone-of","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffigsoda%2Fone-of/lists"}