SolanaAccount

Trait SolanaAccount 

Source
pub trait SolanaAccount: CrateSerialize + CrateDeserialize {
    // Required method
    fn key() -> Key;

    // Provided methods
    fn load(account: &AccountInfo<'_>, offset: usize) -> Result<Self, Error> { ... }
    fn save(
        &self,
        account: &AccountInfo<'_>,
        offset: usize,
    ) -> Result<(), Error> { ... }
}
Expand description

A trait for Solana accounts.

Required Methods§

Source

fn key() -> Key

Get the discriminator key for the account.

Provided Methods§

Source

fn load(account: &AccountInfo<'_>, offset: usize) -> Result<Self, Error>

Load the account from the given account info starting at the offset.

Source

fn save(&self, account: &AccountInfo<'_>, offset: usize) -> Result<(), Error>

Save the account to the given account info starting at the offset.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§