InstructionDecoder

Derive Macro InstructionDecoder 

Source
#[derive(InstructionDecoder)]
{
    // Attributes available to this derive:
    #[instruction_decoder]
    #[discriminator]
}
Expand description

Derives an InstructionDecoder implementation for an Anchor instruction enum.

This macro generates a decoder struct and InstructionDecoder trait implementation that can decode Anchor program instructions for logging purposes.

§Usage

use light_instruction_decoder_derive::InstructionDecoder;

#[derive(InstructionDecoder)]
#[instruction_decoder(
    program_id = "MyProgramId111111111111111111111111111111111",
    program_name = "My Program"
)]
pub enum MyInstruction {
    CreateRecord,
    UpdateRecord { score: u64 },
    DeleteRecord,
}

This generates a MyInstructionDecoder struct that implements InstructionDecoder.