Registry / serialization / zerocopy

zerocopy

JSON →
library0.8.52rscratesunverified

Zerocopy makes zero-cost memory manipulation effortless by providing safe abstractions over unsafe code.

# Cargo.toml [dependencies] zerocopy = "0.8.52"
INSTALL
IMPORT
SIG · ZEROCOPY
Z
zerocopy
serializationrustv0.8.52
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FromBytes
use zerocopy::FromBytes;

Derive FromBytes to safely interpret byte slices as a struct.

use zerocopy::FromBytes; #[derive(FromBytes)] #[repr(C)] struct MyStruct { x: u32, y: u16, } fn main() { let bytes = [0u8; 6]; let my_struct = MyStruct::read_from(&bytes[..]).unwrap(); println!("x: {}, y: {}", my_struct.x, my_struct.y); }
Debug
Known issues
gotchaRequires the `derive` feature for derive macros.
fix
Add `features = ["derive"]` to the zerocopy dependency in Cargo.toml.
affects: >=0.6.0
Upgrade
Version history
0.8.52latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
zerocopy — cargo add zerocopy · libregistry