Registry / serialization / zerocopy-derive

zerocopy-derive

JSON →
library0.8.52rscratesunverified

Custom derive macros for traits from the zerocopy crate, enabling safe zero-copy serialization and deserialization.

# Cargo.toml [dependencies] zerocopy-derive = "0.8.52"
INSTALL
IMPORT
SIG · ZEROCOPY-DERIVE
Z
zerocopy-derive
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_derive::{FromBytes, IntoBytes, AsBytes};

Derives zero-copy traits for a struct.

use zerocopy_derive::{FromBytes, IntoBytes, AsBytes}; #[derive(FromBytes, IntoBytes, AsBytes)] #[repr(C)] struct MyStruct { x: u32, y: u16, } fn main() { let s = MyStruct { x: 42, y: 7 }; let bytes = s.as_bytes(); println!("Bytes: {:?}", bytes); }
Debug
Known issues
gotchaRequires the `zerocopy` crate as a dependency for the trait implementations.
fix
Add `zerocopy` to your Cargo.toml dependencies.
affects: >=0.8.0
Upgrade
Version history
0.8.52latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
26
Amazon
1
Resources
zerocopy-derive — cargo add zerocopy-derive · libregistry