Function spl_token_2022::instruction::decode_instruction_data

source ·
pub fn decode_instruction_data<T: Pod>(
    input_with_type: &[u8],
) -> Result<&T, ProgramError>
Expand description

Utility function for decoding instruction data

Note: This function expects the entire instruction input, including the instruction type as the first byte. This makes the code concise and safe at the expense of clarity, allowing flows such as:

match decode_instruction_type(input)? { InstructionType::First => { let FirstData { … } = decode_instruction_data(input)?; } }