solana_account

Trait WritableAccount

Source
pub trait WritableAccount: ReadableAccount {
    // Required methods
    fn set_lamports(&mut self, lamports: u64);
    fn data_as_mut_slice(&mut self) -> &mut [u8] ;
    fn set_owner(&mut self, owner: Pubkey);
    fn copy_into_owner_from_slice(&mut self, source: &[u8]);
    fn set_executable(&mut self, executable: bool);
    fn set_rent_epoch(&mut self, epoch: Epoch);
    fn create(
        lamports: u64,
        data: Vec<u8>,
        owner: Pubkey,
        executable: bool,
        rent_epoch: Epoch,
    ) -> Self;

    // Provided methods
    fn checked_add_lamports(
        &mut self,
        lamports: u64,
    ) -> Result<(), LamportsError> { ... }
    fn checked_sub_lamports(
        &mut self,
        lamports: u64,
    ) -> Result<(), LamportsError> { ... }
    fn saturating_add_lamports(&mut self, lamports: u64) { ... }
    fn saturating_sub_lamports(&mut self, lamports: u64) { ... }
}

Required Methods§

Source

fn set_lamports(&mut self, lamports: u64)

Source

fn data_as_mut_slice(&mut self) -> &mut [u8]

Source

fn set_owner(&mut self, owner: Pubkey)

Source

fn copy_into_owner_from_slice(&mut self, source: &[u8])

Source

fn set_executable(&mut self, executable: bool)

Source

fn set_rent_epoch(&mut self, epoch: Epoch)

Source

fn create( lamports: u64, data: Vec<u8>, owner: Pubkey, executable: bool, rent_epoch: Epoch, ) -> Self

Provided Methods§

Source

fn checked_add_lamports(&mut self, lamports: u64) -> Result<(), LamportsError>

Source

fn checked_sub_lamports(&mut self, lamports: u64) -> Result<(), LamportsError>

Source

fn saturating_add_lamports(&mut self, lamports: u64)

Source

fn saturating_sub_lamports(&mut self, lamports: u64)

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§