Derive macros for InstructionDecoder implementations
This crate provides two macros:
#[derive(InstructionDecoder)]- For instruction enums (native programs)#[instruction_decoder]- Attribute macro for Anchor program modules
The attribute macro extracts function names from the program module and generates
an instruction enum with #[derive(InstructionDecoder)] applied.
Enhanced InstructionDecoder for Anchor Programs
The derive macro supports an enhanced mode that references Anchor-generated types for account names and parameter decoding:
use InstructionDecoder;
This generates a decoder that:
- Gets account names from
<AccountsType<'_>>::ACCOUNT_NAMES - Decodes instruction data using
ParamsType::try_from_slice()with Debug output