Skip to main content

hopper_args

Attribute Macro hopper_args 

Source
#[hopper_args]
Expand description

Derive a zero-copy borrowing parser for an instruction argument struct.

Emits parse(&[u8]) -> Result<&Self, ArgParseError>, PACKED_SIZE, ARG_DESCRIPTORS, and CU_HINT. The cu attribute lets a program declare a compute-unit budget clients can inspect via the manifest before submission.

§Example

#[hopper::args(cu = 1200)]
#[repr(C)]
pub struct DepositArgs {
    pub amount: [u8; 8],
    pub memo:   [u8; 16],
}