pub unsafe trait ZeroCopy:
Pod
+ 'static
+ HopperZeroCopySealed { }Expand description
Canonical marker for types that may be overlaid on raw bytes.
§Safety
The contract is the same four-point obligation as Pod:
- Every
[u8; size_of::<T>()]bit pattern decodes to a validT. align_of::<T>() == 1.Tcontains no padding.Tcontains no internal pointers or references.
§Sealing
ZeroCopy is gated behind the doc-hidden
[__sealed::HopperZeroCopySealed] marker. Types authored through
#[hopper::pod], #[hopper::state], hopper_layout!, or one of
the framework’s own primitive wire types (WireU64, WireBool,
TypedAddress<T>, etc.) stamp themselves with the seal
automatically. A user bypassing the macros with a bare
unsafe impl Pod does not get ZeroCopy for free. ZeroCopy
is implemented only through the framework-owned sealed path.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".