{"id":13672305,"url":"https://github.com/Lokathor/bytemuck","last_synced_at":"2025-04-27T21:32:37.931Z","repository":{"id":35127872,"uuid":"209673558","full_name":"Lokathor/bytemuck","owner":"Lokathor","description":"A crate for mucking around with piles of bytes","archived":false,"fork":false,"pushed_at":"2025-04-08T23:30:19.000Z","size":489,"stargazers_count":834,"open_issues_count":44,"forks_count":89,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-23T18:54:13.482Z","etag":null,"topics":["rust","zlib-license"],"latest_commit_sha":null,"homepage":"https://docs.rs/bytemuck","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/Lokathor.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["Lokathor"]}},"created_at":"2019-09-20T00:43:50.000Z","updated_at":"2025-04-18T17:29:39.000Z","dependencies_parsed_at":"2024-05-13T17:41:50.789Z","dependency_job_id":"aaf3e038-be2e-4279-becb-fece236b0a59","html_url":"https://github.com/Lokathor/bytemuck","commit_stats":{"total_commits":384,"total_committers":64,"mean_commits":6.0,"dds":"0.31770833333333337","last_synced_commit":"af8d110201aaf6e5846f146b73207f7887327638"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lokathor%2Fbytemuck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lokathor%2Fbytemuck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lokathor%2Fbytemuck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lokathor%2Fbytemuck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lokathor","download_url":"https://codeload.github.com/Lokathor/bytemuck/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251212612,"owners_count":21553488,"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","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":["rust","zlib-license"],"created_at":"2024-08-02T09:01:31.745Z","updated_at":"2025-04-27T21:32:37.626Z","avatar_url":"https://github.com/Lokathor.png","language":"Rust","funding_links":["https://github.com/sponsors/Lokathor"],"categories":["Rust"],"sub_categories":[],"readme":"* **[Latest Docs.rs Here](https://docs.rs/bytemuck/)**\n\n[![License:Zlib](https://img.shields.io/badge/License-Zlib-brightgreen.svg)](https://opensource.org/licenses/Zlib)\n![Minimum Rust Version](https://img.shields.io/badge/Min%20Rust-1.34-green.svg)\n[![crates.io](https://img.shields.io/crates/v/bytemuck.svg)](https://crates.io/crates/bytemuck)\n\n# bytemuck\n\nA crate for mucking around with piles of bytes.\n\nThis crate lets you safely perform \"bit cast\" operations between data types.\nThat's where you take a value and just reinterpret the bits as being some other\ntype of value, without changing the bits.\n\n* This is **not** like the [`as` keyword][keyword-as]\n* This is **not** like the [`From` trait][from-trait]\n* It is **most like** [`f32::to_bits`][f32-to_bits], just generalized to let you\n  convert between all sorts of data types.\n\n[keyword-as]: https://doc.rust-lang.org/nightly/std/keyword.as.html\n[from-trait]: https://doc.rust-lang.org/nightly/core/convert/trait.From.html\n[f32-to_bits]: https://doc.rust-lang.org/nightly/std/primitive.f32.html#method.to_bits\n\n### Here's the part you're more likely to care about: *you can do this with slices too!*\n\nWhen a slice is involved it's not a *direct* bitcast. Instead, the `cast_slice`\nand `cast_slice_mut` functions will pull apart a slice's data and give you a new\nslice that's the same span of memory just viewed as the new type. If the size of\nthe slice's element changes then the length of the slice you get back will be\nchanged accordingly.\n\nThis lets you cast a slice of color values into a slice of `u8` and send it to\nthe GPU, or things like that. I'm sure there's other examples, but honestly this\ncrate is as popular as it is mostly because of Rust's 3D graphics community\nwanting to cast slices of different types into byte slices for sending to the\nGPU. Hi friends! Push those vertices, or whatever it is that you all do.\n\n## See Also\n\nWhile `bytemuck` is full of unsafe code, I've also started a \"sibling crate\"\ncalled [bitfrob](https://docs.rs/bitfrob/latest/bitfrob/), which is where\noperations that are 100% safe will be added.\n\n## Stability\n\n* The crate is 1.0 and I consider this it to be \"basically done\". New features\n  are usually being accepted when other people want to put in the work, but\n  myself I wanna move on to using `bytemuck` in bigger projects.\n* The default build of the `bytemuck` crate will continue to work with `rustc-1.34`\n  for at least the rest of the `1.y.z` versions.\n* Any other cargo features of the crate **are not** held to the same standard, and\n  may work only on the latest Stable or even only on latest Nightly.\n\n**Future Plans:** Once the [Safe Transmute Project][pg-st] completes and\nstabilizes (\"eventually\") this crate will be updated to use that as the\nunderlying mechanism for transmutation bounds, and a 2.0 version of `bytemuck`\nwill be released. The hope is for the 1.0 to 2.0 transition to be as seamless as\npossible, but the future is always uncertain.\n\n[pg-st]: https://rust-lang.github.io/rfcs/2835-project-safe-transmute.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLokathor%2Fbytemuck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLokathor%2Fbytemuck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLokathor%2Fbytemuck/lists"}