pub trait GenericTokenAccount {
    // Required method
    fn valid_account_data(account_data: &[u8]) -> bool;

    // Provided methods
    fn unpack_account_owner_unchecked(account_data: &[u8]) -> &Pubkey { ... }
    fn unpack_account_mint_unchecked(account_data: &[u8]) -> &Pubkey { ... }
    fn unpack_pubkey_unchecked(account_data: &[u8], offset: usize) -> &Pubkey { ... }
    fn unpack_account_owner(account_data: &[u8]) -> Option<&Pubkey> { ... }
    fn unpack_account_mint(account_data: &[u8]) -> Option<&Pubkey> { ... }
}
Expand description

A trait for token Account structs to enable efficiently unpacking various fields without unpacking the complete state.

Required Methods§

source

fn valid_account_data(account_data: &[u8]) -> bool

Check if the account data is a valid token account

Provided Methods§

source

fn unpack_account_owner_unchecked(account_data: &[u8]) -> &Pubkey

Call after account length has already been verified to unpack the account owner

source

fn unpack_account_mint_unchecked(account_data: &[u8]) -> &Pubkey

Call after account length has already been verified to unpack the account mint

source

fn unpack_pubkey_unchecked(account_data: &[u8], offset: usize) -> &Pubkey

Call after account length has already been verified to unpack a Pubkey at the specified offset. Panics if account_data.len() is less than PUBKEY_BYTES

source

fn unpack_account_owner(account_data: &[u8]) -> Option<&Pubkey>

Unpacks an account’s owner from opaque account data.

source

fn unpack_account_mint(account_data: &[u8]) -> Option<&Pubkey>

Unpacks an account’s mint from opaque account data.

Object Safety§

This trait is not object safe.

Implementors§