#[repr(C)]pub struct Account {
pub lamports: u64,
pub data: Vec<u8, Global>,
pub owner: Pubkey,
pub executable: bool,
pub rent_epoch: u64,
}Expand description
An Account with data that is stored on chain
Fields
lamports: u64lamports in the account
data: Vec<u8, Global>data held in this account
owner: Pubkeythe program that owns this account. If executable, the program that loads this account.
executable: boolthis account’s data contains a loaded program (and is now read-only)
rent_epoch: u64the epoch at which this account will next owe rent
Implementations
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, Global>> where
T: Serialize,
pub fn new_ref_data<T>(
lamports: u64,
state: &T,
owner: &Pubkey
) -> Result<RefCell<Account>, Box<ErrorKind, Global>> where
T: Serialize,
pub fn new_data_with_space<T>(
lamports: u64,
state: &T,
space: usize,
owner: &Pubkey
) -> Result<Account, Box<ErrorKind, Global>> where
T: Serialize,
pub fn new_ref_data_with_space<T>(
lamports: u64,
state: &T,
space: usize,
owner: &Pubkey
) -> Result<RefCell<Account>, Box<ErrorKind, Global>> 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, Global>> where
T: DeserializeOwned,
pub fn serialize_data<T>(
&mut self,
state: &T
) -> Result<(), Box<ErrorKind, Global>> where
T: Serialize,
Trait Implementations
impl Account for Account
impl Account for Account
Return the information required to construct an AccountInfo. Used by the
AccountInfo conversion implementations.
impl<'de> Deserialize<'de> for Account
impl<'de> Deserialize<'de> for Account
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
impl PartialEq<Account> for Account
impl PartialEq<Account> for Account
impl ReadableAccount for Account
impl ReadableAccount for Account
impl Serialize for Account
impl Serialize for Account
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
impl<T> StateMut<T> for Account where
T: Serialize + DeserializeOwned,
impl<T> StateMut<T> for Account where
T: Serialize + DeserializeOwned,
fn state(&self) -> Result<T, InstructionError>
fn set_state(&mut self, state: &T) -> Result<(), InstructionError>
impl WritableAccount for Account
impl WritableAccount for Account
fn set_lamports(&mut self, lamports: u64)
fn data_mut(&mut self) -> &mut Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
fn data_as_mut_slice(&mut self) -> &mut [u8]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &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, Global>,
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 StructuralEq for Account
impl StructuralPartialEq for Account
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,
impl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
default fn visit_for_abi(
&self,
digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
impl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
default fn visit_for_abi(
&self,
_digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more