{"id":13648830,"url":"https://github.com/dzamlo/rust-bitfield","last_synced_at":"2025-10-18T14:01:57.333Z","repository":{"id":40627818,"uuid":"97392988","full_name":"dzamlo/rust-bitfield","owner":"dzamlo","description":"This crate provides macros to generate bitfield-like struct.","archived":false,"fork":false,"pushed_at":"2025-10-10T17:52:33.000Z","size":117,"stargazers_count":197,"open_issues_count":16,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-12T08:13:33.410Z","etag":null,"topics":["bitfield","macros","rust"],"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/dzamlo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2017-07-16T15:36:42.000Z","updated_at":"2025-10-10T17:52:24.000Z","dependencies_parsed_at":"2024-01-14T10:59:39.578Z","dependency_job_id":"b19b0d95-2a80-456c-ba09-17508b369b26","html_url":"https://github.com/dzamlo/rust-bitfield","commit_stats":{"total_commits":100,"total_committers":6,"mean_commits":"16.666666666666668","dds":0.06000000000000005,"last_synced_commit":"7de0e736dc46a703eb3a7fcffc3ff4c15598c1df"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/dzamlo/rust-bitfield","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzamlo%2Frust-bitfield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzamlo%2Frust-bitfield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzamlo%2Frust-bitfield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzamlo%2Frust-bitfield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dzamlo","download_url":"https://codeload.github.com/dzamlo/rust-bitfield/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzamlo%2Frust-bitfield/sbom","scorecard":{"id":362617,"data":{"date":"2025-08-11","repo":{"name":"github.com/dzamlo/rust-bitfield","commit":"1a3b1711a6571ca7ecb84178019a3fbd5f03e44e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":1,"reason":"Found 3/27 approved changesets -- score normalized to 1","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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"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 'master'"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 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-18T11:10:07.370Z","repository_id":40627818,"created_at":"2025-08-18T11:10:07.370Z","updated_at":"2025-08-18T11:10:07.370Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279538836,"owners_count":26187258,"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-10-18T02:00:06.492Z","response_time":62,"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":["bitfield","macros","rust"],"created_at":"2024-08-02T01:04:35.113Z","updated_at":"2025-10-18T14:01:57.321Z","avatar_url":"https://github.com/dzamlo.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"rust-bitfield\n=============\n\nThis crate provides macros to generate bitfield-like struct.\n\nThis a complete rewrite of the `bitfield` crate.\nYou can find the previous version in the [rust-bitfield-legacy](https://github.com/dzamlo/rust-bitfield-legacy) repository. This version works on the stable version of rustc and use a different syntax with different possibility.\n\n\n## Example\n\nAn IPv4 header could be described like that:\n\n```rust\nbitfield!{\n    struct IpV4Header(MSB0 [u8]);\n    u32;\n    get_version, _: 3, 0;\n    get_ihl, _: 7, 4;\n    get_dscp, _: 13, 8;\n    get_ecn, _: 15, 14;\n    get_total_length, _: 31, 16;\n    get_identification, _: 47, 32;\n    get_df, _: 49;\n    get_mf, _: 50;\n    get_fragment_offset, _: 63, 51;\n    get_time_to_live, _: 71, 64;\n    get_protocol, _: 79, 72;\n    get_header_checksum, _: 95, 79;\n    get_source_address, _: 127, 96;\n    get_destination_address, _: 159, 128;\n}\n```\n\nIn this example, all the fields are read-only, the _ as setter name signals to skip the setter method.\nThe range at the end (e.g. 3, 0) defines the bit range where the information is encoded.\n\n## Documentation\n\nThe documentation of the released version is available on [doc.rs](https://docs.rs/bitfield).\n\n## Things to watch out for\n\n### MSB and LSB ordering\n\nWhen defining a field, the MSB comes first and the LSB second.\n\n### Sign extension and valid range of signed field\n\nWhen the type of a field is signed (`i8`, `i16`, ...) sign extension is done when reading the field. THis means that if the MSB of the read bits is 1, the returned values will be negative.\n\nThis also means that the valid range of value for the field is different that a unsigend field. A 4 bits field got from -8 (-2\u003csup\u003e3\u003c/sup\u003e) to 7 (2\u003csup\u003e3\u003c/sup\u003e-1) instead of 0 to 15.\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\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzamlo%2Frust-bitfield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdzamlo%2Frust-bitfield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzamlo%2Frust-bitfield/lists"}