CompressiblePack

Derive Macro CompressiblePack 

Source
#[derive(CompressiblePack)]
Expand description

Automatically implements Pack and Unpack traits for compressible accounts.

For types with Pubkey fields, generates a PackedXxx struct and proper packing. For types without Pubkeys, generates identity Pack/Unpack implementations.

§Example

use light_sdk_macros::CompressiblePack;
use light_compressible::CompressionInfo;
use solana_pubkey::Pubkey;

#[derive(CompressiblePack)]
pub struct UserRecord {
    pub compression_info: Option<CompressionInfo>,
    pub owner: Pubkey,  // Will be packed as u8 index
    pub name: String,   // Kept as-is
    pub score: u64,     // Kept as-is
}
// This generates PackedUserRecord struct + Pack/Unpack implementations