pub unsafe trait Pod:
Sized
+ Copy
+ Pod
+ Zeroable { }Expand description
Marker for types that can be safely overlaid on raw account bytes.
§Safety
Implementing Pod for a type T asserts all of:
- Every
[u8; size_of::<T>()]bit pattern decodes to a validT. align_of::<T>() == 1.Tcontains no padding.Tcontains no internal pointers or references.
With feature = "bytemuck" on (default), the trait is sealed so
callers must also prove T: bytemuck::Pod + bytemuck::Zeroable,
which gets them obligations 1, 3, and 4 mechanically via bytemuck’s
derive. Obligation 2 (alignment) is still a Hopper-specific
constraint enforced by the #[hopper::pod] / #[hopper::state]
compile-time asserts.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.