{"id":15400454,"url":"https://github.com/haxelion/bytepack","last_synced_at":"2025-09-12T04:31:52.538Z","repository":{"id":62438701,"uuid":"85488432","full_name":"haxelion/bytepack","owner":"haxelion","description":"A byte packing crate for rust","archived":false,"fork":false,"pushed_at":"2017-05-21T17:09:25.000Z","size":13,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T20:20:15.793Z","etag":null,"topics":["crate","data","io","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haxelion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-19T15:47:18.000Z","updated_at":"2020-02-24T16:49:37.000Z","dependencies_parsed_at":"2022-11-01T21:47:48.410Z","dependency_job_id":null,"html_url":"https://github.com/haxelion/bytepack","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/haxelion/bytepack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxelion%2Fbytepack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxelion%2Fbytepack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxelion%2Fbytepack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxelion%2Fbytepack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haxelion","download_url":"https://codeload.github.com/haxelion/bytepack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haxelion%2Fbytepack/sbom","scorecard":{"id":457969,"data":{"date":"2025-08-11","repo":{"name":"github.com/haxelion/bytepack","commit":"0c3d7d896fe1a3cd70388bf13dc050cbd854ea99"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/16 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":"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":"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":"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":-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":"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":"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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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"}}]},"last_synced_at":"2025-08-19T10:15:51.846Z","repository_id":62438701,"created_at":"2025-08-19T10:15:51.846Z","updated_at":"2025-08-19T10:15:51.846Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274753611,"owners_count":25342825,"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-09-12T02:00:09.324Z","response_time":60,"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":["crate","data","io","rust"],"created_at":"2024-10-01T15:53:58.687Z","updated_at":"2025-09-12T04:31:52.518Z","avatar_url":"https://github.com/haxelion.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"bytepack\n========\n\n[![Crates.io](https://img.shields.io/crates/v/bytepack.svg)](https://crates.io/crates/bytepack)\n[![Build Status](https://travis-ci.org/haxelion/bytepack.svg?branch=master)](https://travis-ci.org/haxelion/bytepack)\n[![Docs.rs](https://docs.rs/bytepack/badge.svg)](https://docs.rs/bytepack)\n\n`bytepack` is a simple crate which extends the `std::io` API to be able to read and write any \ndata type in their memory representation. It can be seen as a generalization of the \n`std::io::Read` and `std::io::Write` trait , but operating on a generic parameter `T` instead \nof `u8`. This crate focus on performances by beeing no copy (except in one clearly marked case) \nand offering methods to read and write arrays.\n\n`bytepack` offers three trait famillies allowing different endianness control. \n`Unpacker` and `Packer` read and write data in the endianness of the operating system. `LEUnpacker` \nand `LEPacker` always read and write data in little endian while `BEUnpacker` and `BEPacker` do the \nsame in big endian. They all conform to the same API which is copied from the one of `std::io`.\nThis means switching from one endianness to another can be done by simply bringing a different \ntrait in scope.\n\nBecause `bytepack` is not a serialization library, it cannot read and write complex types like \n`Vec`, `Rc`, etc. directly from a Reader or to Writer. Indeed those types do not contain the \nunderlying data directly packed inside but rather hold a reference or a pointer to it. To \nidentify types which holds their data \"packed\" together, the `Packed` trait is used. Additionnaly \nit provides a in-place endianness switching method. One can implement this trait for the data types \ndeemed safe to read and write. An automatic derive for structures made only of types implementing \n`Packed` is also implemented in the [`bytepack_derive`](https://github.com/haxelion/bytepack_derive) \ncrate.\n\nExamples\n--------\n\nHere are two functions which can serialize and deserialize a `Vec\u003cf32\u003e`:\n\n``` rust\nextern crate bytepack;\n\nuse std::fs::File;\nuse std::iter::repeat;\n\nuse bytepack::{LEPacker, LEUnpacker};\n\nfn write_samples(file: \u0026str, samples: \u0026Vec\u003cf32\u003e) {\n    let mut file = File::create(file).unwrap();\n    file.pack(samples.len() as u32).unwrap();\n    file.pack_all(\u0026samples[..]).unwrap();\n}\n\nfn read_samples(file: \u0026str) -\u003e Vec\u003cf32\u003e {\n    let mut file = File::open(file).unwrap();\n    let num_samples : u32 = file.unpack().unwrap();\n    let mut samples : Vec\u003cf32\u003e = repeat(0f32).take(num_samples as usize).collect();\n    file.unpack_exact(\u0026mut samples[..]).unwrap();\n    return samples;\n}\n```\n\nThanks to the genericity of the `Packed` trait we could make the previous function generic:\n\n``` rust\nextern crate bytepack;\n\nuse std::fs::File;\n\nuse bytepack::{LEPacker, Packed};\n\nfn write_vec\u003cT: Packed + Clone\u003e(file: \u0026str, samples: \u0026Vec\u003cT\u003e) {\n    let mut file = File::create(file).unwrap();\n    file.pack(samples.len() as u32).unwrap();\n    file.pack_all(\u0026samples[..]).unwrap();\n}\n```\n\nBecause we can derive Packed for our own struct, we can use them with our own types:\n\n``` rust\nextern crate bytepack;\n#[macro_use]\nextern crate bytepack_derive;\n\nuse std::fs::File;\n\nuse bytepack::{LEPacker, Packed};\n\n#[derive(Packed, Clone)]\nstruct Vertex\u003cT: Packed\u003e {\n    x: T,\n    y: T,\n    z: T\n}\n\nfn write_vec\u003cT: Packed + Clone\u003e(file: \u0026str, samples: \u0026Vec\u003cT\u003e) {\n    let mut file = File::create(file).unwrap();\n    file.pack(samples.len() as u32).unwrap();\n    file.pack_all(\u0026samples[..]).unwrap();\n}\n\nfn main() {\n    let square : Vec\u003cVertex\u003cf32\u003e\u003e = vec![\n        Vertex{x: 0.0, y: 0.0, z: 0.0},\n        Vertex{x: 1.0, y: 0.0, z: 0.0},\n        Vertex{x: 1.0, y: 1.0, z: 0.0},\n        Vertex{x: 0.0, y: 1.0, z: 0.0},\n    ];\n\n    write_vec(\"square.raw\", \u0026square);\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaxelion%2Fbytepack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaxelion%2Fbytepack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaxelion%2Fbytepack/lists"}