Skip to main content

AccountData

Struct AccountData 

Source
pub struct AccountData {
    pub data: EncodedBinary,
    pub executable: bool,
    pub lamports: u64,
    pub owner: Address,
    pub space: u64,
}
Expand description

An account’s full state, used as an account override.

On the wire: {"data": {"data": "<base64>", "encoding": "base64"}, "executable": false, "lamports": 1000000, "owner": "<base58>", "space": 0}.

  • The override replaces the whole account. To change a token balance, build the token account’s bytes with token.
  • rent_epoch is not carried; the session sets it to 0.
  • Scheduled-action, depth and simulateTransaction overrides reject an executable account or one owned by a program loader: a program cannot be overridden this way.

Fields§

§data: EncodedBinary

Account data bytes and encoding.

§executable: bool

Whether the account is executable.

§lamports: u64

Balance in lamports (1 SOL = 1,000,000,000 lamports).

§owner: Address

The owning program, base58.

§space: u64

The data length in bytes. Set it to the decoded length of data: the account’s size comes from data, not from this field.

Implementations§

Source§

impl AccountData

Source

pub fn to_account(&self) -> Result<Account, Base64DecodeError>

The account these fields describe, with rent_epoch 0. Fails if data does not decode.

Source

pub fn system_account(lamports: u64) -> Self

A system-owned account with no data holding lamports. At 0 the account does not exist.

Trait Implementations§

Source§

impl Clone for AccountData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AccountData

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AccountData

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for AccountData

Source§

impl From<&Account> for AccountData

The wire form of account: base64 data, space = data.len(). The inverse of AccountData::to_account; rent_epoch is dropped because the wire does not carry it.

Source§

fn from(account: &Account) -> Self

Converts to this type from the input type.
Source§

impl Hash for AccountData

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AccountData

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AccountData

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AccountData

Auto Trait Implementations§

§

impl Forget for AccountData

§

impl Freeze for AccountData
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for AccountData

§

impl RefUnwindSafe for AccountData

§

impl Send for AccountData
where RawVecInner: Send,

§

impl Sync for AccountData
where RawVecInner: Sync,

§

impl Unpin for AccountData
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for AccountData

§

impl UnwindSafe for AccountData
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V