{"id":16002045,"url":"https://github.com/blaind/embedded-semver","last_synced_at":"2026-02-14T19:02:43.794Z","repository":{"id":44666741,"uuid":"359492361","full_name":"blaind/embedded-semver","owner":"blaind","description":"Compact representation of semantic versions as an i32, u32 i64 or u64","archived":false,"fork":false,"pushed_at":"2022-08-26T17:24:09.000Z","size":16,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-26T08:43:57.763Z","etag":null,"topics":["embedded","rust","semver"],"latest_commit_sha":null,"homepage":"","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/blaind.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}},"created_at":"2021-04-19T14:39:10.000Z","updated_at":"2021-10-25T16:49:42.000Z","dependencies_parsed_at":"2022-08-26T22:22:04.331Z","dependency_job_id":null,"html_url":"https://github.com/blaind/embedded-semver","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/blaind/embedded-semver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaind%2Fembedded-semver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaind%2Fembedded-semver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaind%2Fembedded-semver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaind%2Fembedded-semver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blaind","download_url":"https://codeload.github.com/blaind/embedded-semver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaind%2Fembedded-semver/sbom","scorecard":{"id":242439,"data":{"date":"2025-08-11","repo":{"name":"github.com/blaind/embedded-semver","commit":"cf732624e988ab43eeb21848a292c343cd4c7ab7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.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":"Code-Review","score":0,"reason":"Found 0/5 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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/blaind/embedded-semver/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/blaind/embedded-semver/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/blaind/embedded-semver/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/blaind/embedded-semver/test.yml/main?enable=pin","Info:   0 out of   4 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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE-APACHE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE-APACHE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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"}}]},"last_synced_at":"2025-08-17T06:54:32.257Z","repository_id":44666741,"created_at":"2025-08-17T06:54:32.257Z","updated_at":"2025-08-17T06:54:32.257Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29452590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"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":["embedded","rust","semver"],"created_at":"2024-10-08T10:01:20.095Z","updated_at":"2026-02-14T19:02:43.775Z","avatar_url":"https://github.com/blaind.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# embedded-semver \u0026emsp; [![Build Status]][actions] [![Latest Version]][crates.io] [![Docs Version]][docs] [![Lines of Code]][github]\n\n[Build Status]: https://img.shields.io/github/workflow/status/blaind/embedded-semver/test\n[actions]: https://github.com/blaind/embedded-semver/actions?query=branch%3Amain\n[Latest Version]: https://img.shields.io/crates/v/embedded-semver.svg\n[crates.io]: https://crates.io/crates/embedded-semver\n[Lines of Code]: https://tokei.rs/b1/github/blaind/embedded-semver?category=code\n[github]: https://github.com/blaind/embedded-semver\n\n[Docs Version]: https://docs.rs/embedded-semver/badge.svg\n[docs]: https://docs.rs/embedded-semver\n\nCompact representation of semantic versions as an i32, u32 i64 or u64\n\nBecause the integer formats have limited space, there are limits for semver field\n(major, minor, patch) sizes depending on type (`0 - 1023` for 32 bits, `0 - 65535` for 64 bits).\n\n## Examples\n\n### Encoding\n\nEncode a semver to an integer\n\n```rust\nuse embedded_semver::Semver;\n\nlet version = Semver::new(1, 0, 20);\nlet int_semver = version.to_i32().unwrap();\n\nassert_eq!(int_semver, 83886081);\nassert_eq!(\u0026int_semver.to_le_bytes(), \u0026[\n  0b0000_0001,\n  0b0000_0000,\n  0b0000_0000,\n  0b0000_0101\n]);\n```\n\n### Decoding\n\nDecode an integer into a semver:\n\n```rust\nuse embedded_semver::Semver;\n\nlet int_semver: i32 = 83886081;\n\nlet version = Semver::from_i32(int_semver).unwrap();\nassert_eq!(version, Semver::new(1, 0, 20));\n```\n\n## Feature flags\n\nFor no-std support, add as a dependency without default features:\n\n```text\nembedded-semver = { version = \"...\", default-features = false }\n```\n\n## Binary format\n\n* Fields are packed with the most significant bit first (see [Msb0](https://docs.rs/bitvec/0.22.3/bitvec/order/struct.Msb0.html))\n* Format contains a 2-bit (on 32-bit values) and 4-bit (on 64-bit values) api version, which\n  allows for extensibility and/or api changes in future\n\n### 32 bits\n\nThe binary format for `i32` and `u32` is represented below. Fields:\n\n* `version`: First two bits represent the API version (packed data format). Currenly 0 = V0\n* `major`: Next 10 bits represent major in range of 0-1023\n* `minor`: Next 10 bits represent minor in range of 0-1023\n* `patch`: Next 10 bits represent patch in range of 0-1023\n\n```text\n0         2        12        22        32\n├────┴────┼┴┴┴┴┴┴┴┴┴┼┴┴┴┴┴┴┴┴┴┼┴┴┴┴┴┴┴┴┴┤\n│ API ver │ Major   │ Minor   │ Patch   │\n│ u2      │ u10     │ u10     │ u10     │\n└─────────┴─────────┴─────────┴─────────┘\n```\n\n### 64 bits\n\nThe binary format for `i64` and `u64` is represented below. Fields:\n\n* `version`: First four bits represent the API version (packed data format). Currenly 0 = V0\n* `major`: Next 16 bits represent major in range of 0-65535\n* `minor`: Next 16 bits represent minor in range of 0-65535\n* `patch`: Next 16 bits represent patch in range of 0-65535\n* 12 remaining bits are unused\n\n```text\n0         4              20                36                52          64\n├─┴──┴─┴──┼┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┼┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┼┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┼┴┴┴┴┴┴┴┴┴┴┴┤\n│ API ver │ Major         │ Minor           │ Patch           | (unused)  │\n│ u4      │ u16           │ u16             │ u16             | u12       │\n└─────────┴───────────────┴─────────────────┴─────────────────┴───────────┘\n```\n\n## Notes about conversions\n\nNote that the binary representations in i32 and i64 are not the same:\n\n```rust\nuse embedded_semver::{Semver, Error, Magic};\n\nlet value: i32 = 16904511;\nassert_eq!(Semver::from_i32(value).unwrap(), Semver::new(1023, 1, 5));\nassert_eq!(\n    Semver::from_i64(value as i64).unwrap_err(),\n    Error::UnsupportedMagic(Magic::V3)\n);\n```\n\nHowever, the underlying bits in u32 and i32 represent the same values:\n\n```rust\nuse embedded_semver::{Semver, Error};\n\nlet value: i32 = 16843009;\nlet bytes = value.to_le_bytes();\nlet i32_value = i32::from_le_bytes(bytes.clone());\nlet u32_value = u32::from_le_bytes(bytes);\nassert_eq!(Semver::from_i32(i32_value).unwrap(), Semver::new(1, 1, 5));\nassert_eq!(Semver::from_u32(u32_value).unwrap(), Semver::new(1, 1, 5));\n```\n\n## Performance\n\nNo need to worry :)\n\n```text\ntest bench_from_i32 ... bench:          51 ns/iter (+/- 1)\ntest bench_from_i64 ... bench:          54 ns/iter (+/- 1)\ntest bench_to_i32   ... bench:          75 ns/iter (+/- 1)\ntest bench_to_i64   ... bench:          84 ns/iter (+/- 2)\n```\n\n## Rust Version Support\n\nThe minimum supported Rust version is 1.51\n\n## Future plans\n\nNone currently\n\n## License\nCompact semantic version representation\n* \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version 2.0\u003c/a\u003e or\n* \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e\n\nat your option.\n\n### Contribution\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the software by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblaind%2Fembedded-semver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblaind%2Fembedded-semver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblaind%2Fembedded-semver/lists"}