HasCompressionInfo

Derive Macro HasCompressionInfo 

Source
#[derive(HasCompressionInfo)]
Expand description

Automatically implements the HasCompressionInfo trait for structs that have a compression_info: Option<CompressionInfo> field.

This derive macro generates the required trait methods for managing compression information in compressible account structs.

§Example

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

#[derive(HasCompressionInfo)]
pub struct UserRecord {
    #[skip]
    pub compression_info: Option<CompressionInfo>,
    pub owner: Pubkey,
    pub name: String,
    pub score: u64,
}

§Requirements

The struct must have exactly one field named compression_info of type Option<CompressionInfo>. The field should be marked with #[skip] to exclude it from hashing.