.. /index

zerocopy

zerocopy

Google's zerocopy crate provides safe, zero-cost conversions between byte sequences and typed data. Version 0.8 was a landmark release that makes it the recommended choice over bytemuck for all new Rust code requiring transmute-like operations.

What 0.8 brought

zerocopy vs bytemuck

For network protocol parsing, security-critical paths, and complex data structures (enums, DSTs), zerocopy 0.8 is strictly superior. bytemuck remains simpler for basic Pod casting and has deep roots in the Solana/wgpu ecosystem, so migration isn't urgent for existing code. But for anything new, use zerocopy.

zerocopy is developed in coordination with Rust's Project Safe Transmute, making it the most likely crate to align with future language-level transmute safety guarantees.

Linked from

Sources