{"id":57174,"library":"bytemuck","title":"bytemuck","description":"A crate for mucking around with piles of bytes.","status":"active","version":"1.25.0","language":"rust","source_language":null,"source_url":"https://github.com/Lokathor/bytemuck","tags":["bytes","cast","unsafe","zero-copy","serialization"],"install":[{"cmd":"# Cargo.toml\n[dependencies]\nbytemuck = \"1.25.0\"","lang":"toml","label":"Cargo.toml"},{"cmd":"cargo add bytemuck","lang":"bash","label":"cargo add"}],"dependencies":[],"imports":[{"symbol":"cast","correct":"use bytemuck::cast;"}],"quickstart":{"code":"use bytemuck::cast;\n\nfn main() {\n    let value: u32 = 0x12345678;\n    let bytes: [u8; 4] = cast(value);\n    println!(\"{:?}\", bytes);\n}","lang":"rust","description":"Reinterpret a u32 as a byte array using bytemuck."},"warnings":[{"fix":"Ensure types implement Pod (plain old data) or Zeroable, and avoid casting between types with different sizes","message":"Undefined behavior if types have padding or invalid bit patterns","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'around':6 'byte':10,11 'bytemuck':1 'cast':12 'copi':16 'crate':3 'muck':5 'pile':8 'serial':17 'unsaf':13 'zero':15 'zero-copi':14","created_at":"2026-06-16T15:31:25.894223+00:00","updated_at":"2026-06-16T15:31:25.894223+00:00","problems":[],"ecosystem":"crates","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Lokathor/bytemuck","github":"https://github.com/Lokathor/bytemuck","docs":"https://docs.rs/bytemuck/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["utility"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-16","next_check":"2026-12-13","install_tag":null}}