#[repr(C)]pub struct Account {
pub lamports: u64,
pub data: Vec<u8>,
pub owner: Pubkey,
pub executable: bool,
pub rent_epoch: u64,
}
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)
When feature deprecate_executable_meta_update_in_bpf_loader
is active,
executable
is deprecated, please use fn is_executable(&account)
instead.
rent_epoch: u64
the epoch at which this account will next owe rent
Implementationsยง
sourceยงimpl Account
impl Account
pub fn new(lamports: u64, space: usize, owner: &Pubkey) -> Account
pub fn new_ref( lamports: u64, space: usize, owner: &Pubkey ) -> Rc<RefCell<Account>>
pub fn new_data<T>(
lamports: u64,
state: &T,
owner: &Pubkey
) -> Result<Account, Box<ErrorKind>>where
T: Serialize,
pub fn new_ref_data<T>(
lamports: u64,
state: &T,
owner: &Pubkey
) -> Result<RefCell<Account>, Box<ErrorKind>>where
T: Serialize,
pub fn new_data_with_space<T>(
lamports: u64,
state: &T,
space: usize,
owner: &Pubkey
) -> Result<Account, Box<ErrorKind>>where
T: Serialize,
pub fn new_ref_data_with_space<T>(
lamports: u64,
state: &T,
space: usize,
owner: &Pubkey
) -> Result<RefCell<Account>, Box<ErrorKind>>where
T: Serialize,
pub fn new_rent_epoch( lamports: u64, space: usize, owner: &Pubkey, rent_epoch: u64 ) -> Account
pub fn deserialize_data<T>(&self) -> Result<T, Box<ErrorKind>>where
T: DeserializeOwned,
pub fn serialize_data<T>(&mut self, state: &T) -> Result<(), Box<ErrorKind>>where
T: Serialize,
Trait Implementationsยง
sourceยงimpl Account for Account
impl Account for Account
Return the information required to construct an AccountInfo
. Used by the
AccountInfo
conversion implementations.
sourceยงimpl<'de> Deserialize<'de> for Account
impl<'de> Deserialize<'de> for Account
sourceยงfn deserialize<__D>(
__deserializer: __D
) -> Result<Account, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Account, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceยงfn from(other: Account) -> AccountSharedData
fn from(other: Account) -> AccountSharedData
Converts to this type from the input type.
sourceยงfn from(other: AccountSharedData) -> Account
fn from(other: AccountSharedData) -> Account
Converts to this type from the input type.
sourceยงimpl PartialEq for Account
impl PartialEq for Account
sourceยงimpl ReadableAccount for Account
impl ReadableAccount for Account
sourceยงimpl Serialize for Account
impl Serialize for Account
sourceยงfn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
sourceยงimpl WritableAccount for Account
impl WritableAccount for Account
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: u64)
fn create( lamports: u64, data: Vec<u8>, owner: Pubkey, executable: bool, rent_epoch: u64 ) -> Account
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)
impl Eq for Account
impl StructuralPartialEq for Account
Auto Trait Implementationsยง
impl Freeze for Account
impl RefUnwindSafe for Account
impl Send for Account
impl Sync for Account
impl Unpin for Account
impl UnwindSafe for Account
Blanket Implementationsยง
sourceยงimpl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester ) -> Result<AbiDigester, DigestError>
sourceยงimpl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, digester: &mut AbiDigester ) -> Result<AbiDigester, DigestError>
sourceยงimpl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
sourceยงimpl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
sourceยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.