{"id":59612,"library":"zerocopy-derive","title":"Zerocopy Derive","description":"Custom derive macros for traits from the zerocopy crate, enabling safe zero-copy serialization and deserialization.","status":"active","version":"0.8.52","language":"rust","source_language":null,"source_url":"https://github.com/google/zerocopy","tags":["zerocopy","derive","serialization","no-std"],"install":[{"cmd":"# Cargo.toml\n[dependencies]\nzerocopy-derive = \"0.8.52\"","lang":"toml","label":"Cargo.toml"},{"cmd":"cargo add zerocopy-derive","lang":"bash","label":"cargo add"}],"dependencies":[],"imports":[{"symbol":"FromBytes","correct":"use zerocopy_derive::{FromBytes, IntoBytes, AsBytes};"}],"quickstart":{"code":"use zerocopy_derive::{FromBytes, IntoBytes, AsBytes};\n\n#[derive(FromBytes, IntoBytes, AsBytes)]\n#[repr(C)]\nstruct MyStruct {\n    x: u32,\n    y: u16,\n}\n\nfn main() {\n    let s = MyStruct { x: 42, y: 7 };\n    let bytes = s.as_bytes();\n    println!(\"Bytes: {:?}\", bytes);\n}","lang":"rust","description":"Derives zero-copy traits for a struct."},"warnings":[{"fix":"Add `zerocopy` to your Cargo.toml dependencies.","message":"Requires the `zerocopy` crate as a dependency for the trait implementations.","severity":"gotcha","affected_versions":">=0.8.0"}],"env_vars":null,"search_vec":"'copi':16 'crate':11 'custom':3 'deriv':2,4,21 'deseri':19 'enabl':12 'macro':5 'no-std':23 'safe':13 'serial':17,22 'std':25 'trait':7 'zero':15 'zero-copi':14 'zerocopi':1,10,20","created_at":"2026-06-16T17:10:39.182649+00:00","updated_at":"2026-06-16T17:10:39.182649+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/google/zerocopy","github":"https://github.com/google/zerocopy","docs":"https://docs.rs/zerocopy-derive/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"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}}