Struct solana_sdk::account::Account[][src]

#[repr(C)]
pub struct Account { pub lamports: u64, pub data: Vec<u8>, pub owner: Pubkey, pub executable: bool, pub rent_epoch: Epoch, }
Expand description

An Account with data that is stored on chain

Fields

lamports: u64

lamports in the account

data: Vec<u8>

data held in this account

owner: Pubkey

the program that owns this account. If executable, the program that loads this account.

executable: bool

this account’s data contains a loaded program (and is now read-only)

rent_epoch: Epoch

the epoch at which this account will next owe rent

Implementations

impl Account[src]

pub fn new(lamports: u64, space: usize, owner: &Pubkey) -> Self[src]

pub fn new_ref(lamports: u64, space: usize, owner: &Pubkey) -> Rc<RefCell<Self>>[src]

pub fn new_data<T: Serialize>(
    lamports: u64,
    state: &T,
    owner: &Pubkey
) -> Result<Self, Error>
[src]

pub fn new_ref_data<T: Serialize>(
    lamports: u64,
    state: &T,
    owner: &Pubkey
) -> Result<RefCell<Self>, Error>
[src]

pub fn new_data_with_space<T: Serialize>(
    lamports: u64,
    state: &T,
    space: usize,
    owner: &Pubkey
) -> Result<Self, Error>
[src]

pub fn new_ref_data_with_space<T: Serialize>(
    lamports: u64,
    state: &T,
    space: usize,
    owner: &Pubkey
) -> Result<RefCell<Self>, Error>
[src]

pub fn deserialize_data<T: DeserializeOwned>(&self) -> Result<T, Error>[src]

pub fn serialize_data<T: Serialize>(&mut self, state: &T) -> Result<(), Error>[src]

Trait Implementations

impl AbiExample for Account[src]

fn example() -> Self[src]

impl Account for Account[src]

Return the information required to construct an AccountInfo. Used by the AccountInfo conversion implementations.

fn get(&mut self) -> (&mut u64, &mut [u8], &Pubkey, bool, Epoch)[src]

impl Clone for Account[src]

fn clone(&self) -> Account[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Account[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Account[src]

fn default() -> Account[src]

Returns the “default value” for a type. Read more

impl<'de> Deserialize<'de> for Account[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl From<Account> for AccountSharedData[src]

fn from(other: Account) -> Self[src]

Performs the conversion.

impl From<AccountSharedData> for Account[src]

fn from(other: AccountSharedData) -> Self[src]

Performs the conversion.

impl PartialEq<Account> for Account[src]

fn eq(&self, other: &Account) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Account) -> bool[src]

This method tests for !=.

impl ReadableAccount for Account[src]

fn lamports(&self) -> u64[src]

fn data(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn owner(&self) -> &Pubkey[src]

fn executable(&self) -> bool[src]

fn rent_epoch(&self) -> Epoch[src]

fn to_account_shared_data(&self) -> AccountSharedData[src]

impl Serialize for Account[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl<T> StateMut<T> for Account where
    T: Serialize + DeserializeOwned
[src]

fn state(&self) -> Result<T, InstructionError>[src]

fn set_state(&mut self, state: &T) -> Result<(), InstructionError>[src]

impl WritableAccount for Account[src]

fn set_lamports(&mut self, lamports: u64)[src]

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

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn set_owner(&mut self, owner: Pubkey)[src]

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

fn set_executable(&mut self, executable: bool)[src]

fn set_rent_epoch(&mut self, epoch: Epoch)[src]

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

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

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

impl Eq for Account[src]

impl StructuralEq for Account[src]

impl StructuralPartialEq for Account[src]

Auto Trait Implementations

impl RefUnwindSafe for Account

impl Send for Account

impl Sync for Account

impl Unpin for Account

impl UnwindSafe for Account

Blanket Implementations

impl<T> AbiEnumVisitor for T where
    T: Serialize + AbiExample + ?Sized
[src]

pub default fn visit_for_abi(
    &self,
    digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
[src]

impl<T> AbiEnumVisitor for T where
    T: Serialize + ?Sized
[src]

pub default fn visit_for_abi(
    &self,
    _digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
[src]

impl<T> AbiExample for T[src]

pub default fn example() -> T[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]