#[hopper_pod]Expand description
Derive the Hopper zero-copy marker contract for a user-defined struct.
Unlike #[hopper::state] (which emits the full Hopper layout: 16-byte
header, layout_id, schema export, typed load helpers), #[hopper::pod]
is the minimal opt-in: it asserts that the struct satisfies the
Pod + FixedLayout + alignment-1 + non-padded + non-zero-sized contract
at compile time, and emits the matching unsafe impl Pod and
impl FixedLayout so it can participate in every Hopper segment /
raw access API.
This is the Hopper Safety Audit’s “derive macros for Pod and layout”
recommendation delivered standalone: use it on sub-structs, wire
helpers, or any #[repr(C)] overlay that isn’t a full top-level
account layout.
§Example
ⓘ
#[hopper::pod]
#[repr(C)]
pub struct Cursor {
pub head: WireU64,
pub tail: WireU64,
pub capacity: WireU64,
}
// Now usable as:
let c: Ref<'_, Cursor> = account.segment_ref::<Cursor>(&mut borrows, 0, 24)?;