pub struct CruiserAccountInfo {
pub key: &'static Pubkey,
pub is_signer: bool,
pub is_writable: bool,
pub lamports: Rc<RefCell<&'static mut u64>>,
pub data: Rc<RefCell<&'static mut [u8]>>,
pub original_data_len: &'static usize,
pub owner: &'static RefCell<&'static mut Pubkey>,
pub executable: bool,
pub rent_epoch: Epoch,
}Expand description
A custom version of Solana’s AccountInfo that allows for owner changes.
Fields§
§key: &'static PubkeyThe public key of the account.
is_signer: boolWhether the account is a signer of the transaction
is_writable: boolWhether the account is writable
lamports: Rc<RefCell<&'static mut u64>>How many lamports the account has.
§Change Limitations
- Lamports must not have been created or destroyed by transaction’s end
- Lamports may only be subtracted from accounts owned by the subtracting program
data: Rc<RefCell<&'static mut [u8]>>The data the account stores. Public information, can be read by anyone on the network. Also stores the starting length so can error if changed too far.
§Change Limitations
- Data size may only be changed by the system program
- Data size cannot be changed once set except by account wipe if no rent
- Data can only be changed by the owning program
- Data will be wiped if there is no rent
original_data_len: &'static usizeThe original data size. Can only see in it’s own call meaning the parent CPI size won’t be passed down.
owner: &'static RefCell<&'static mut Pubkey>The owning program of the account, defaults to the system program for new accounts
§Change Limitations
- Owner can only be changed by the owning program
- All data must be zeroed to be transferred
executable: boolWhether or not the account is executable
rent_epoch: EpochThe next epoch this account owes rent. Can be rent free by giving two years of rent.
Implementations§
Source§impl CruiserAccountInfo
impl CruiserAccountInfo
Sourcepub unsafe fn to_solana_account_info<'a>(&self) -> SolanaAccountInfo<'a>
pub unsafe fn to_solana_account_info<'a>(&self) -> SolanaAccountInfo<'a>
Turns this into a normal solana_program::account_info::AccountInfo for usage with standard functions.
§Safety
The resulting account info has owner as a shared reference that can be modified. Only use this when the resulting account info will never be used after another use of self or any values stemming from self.
Trait Implementations§
Source§impl AccountArgument for CruiserAccountInfo
impl AccountArgument for CruiserAccountInfo
Source§type AccountInfo = CruiserAccountInfo
type AccountInfo = CruiserAccountInfo
Source§fn write_back(self, _program_id: &Pubkey) -> CruiserResult<()>
fn write_back(self, _program_id: &Pubkey) -> CruiserResult<()>
Source§fn add_keys(
&self,
add: impl FnMut(Pubkey) -> CruiserResult<()>,
) -> CruiserResult<()>
fn add_keys( &self, add: impl FnMut(Pubkey) -> CruiserResult<()>, ) -> CruiserResult<()>
Source§impl<'a> AccountInfoAccess<'a> for CruiserAccountInfo
impl<'a> AccountInfoAccess<'a> for CruiserAccountInfo
Source§type LamportsMut = RefMut<'a, u64>
type LamportsMut = RefMut<'a, u64>
AccountInfoAccess::lamports_mutSource§fn is_writable(&'a self) -> bool
fn is_writable(&'a self) -> bool
Source§fn lamports_mut(&'a self) -> Self::LamportsMut
fn lamports_mut(&'a self) -> Self::LamportsMut
Source§unsafe fn realloc_unsafe(
&self,
new_len: usize,
zero_init: bool,
) -> CruiserResult
unsafe fn realloc_unsafe( &self, new_len: usize, zero_init: bool, ) -> CruiserResult
SafeRealloc whenever possible. Read moreSource§unsafe fn set_owner_unsafe(&self, new_owner: &Pubkey)
unsafe fn set_owner_unsafe(&self, new_owner: &Pubkey)
SafeOwnerChangeAccess::owner_mut if possible. Read moreSource§fn executable(&self) -> bool
fn executable(&self) -> bool
Source§fn rent_epoch(&self) -> Epoch
fn rent_epoch(&self) -> Epoch
Source§impl Clone for CruiserAccountInfo
impl Clone for CruiserAccountInfo
Source§fn clone(&self) -> CruiserAccountInfo
fn clone(&self) -> CruiserAccountInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CruiserAccountInfo
impl Debug for CruiserAccountInfo
Source§impl FromAccounts<()> for CruiserAccountInfo
impl FromAccounts<()> for CruiserAccountInfo
Source§fn from_accounts(
_program_id: &Pubkey,
infos: &mut impl AccountInfoIterator<Item = Self::AccountInfo>,
_arg: (),
) -> CruiserResult<Self>
fn from_accounts( _program_id: &Pubkey, infos: &mut impl AccountInfoIterator<Item = Self::AccountInfo>, _arg: (), ) -> CruiserResult<Self>
Source§fn accounts_usage_hint(_arg: &()) -> (usize, Option<usize>)
fn accounts_usage_hint(_arg: &()) -> (usize, Option<usize>)
FromAccounts::from_accounts is called.
Returns (lower_bound, upper_bound) where lower_bound is the minimum and upper_bound is the maximum or None if there is no maximum. Read moreSource§impl MultiIndexable<()> for CruiserAccountInfo
impl MultiIndexable<()> for CruiserAccountInfo
Source§fn index_is_signer(&self, _indexer: ()) -> CruiserResult<bool>
fn index_is_signer(&self, _indexer: ()) -> CruiserResult<bool>
indexer is a signer.Source§fn index_is_writable(&self, _indexer: ()) -> CruiserResult<bool>
fn index_is_writable(&self, _indexer: ()) -> CruiserResult<bool>
indexer is writable.Source§fn index_is_owner(&self, owner: &Pubkey, _indexer: ()) -> CruiserResult<bool>
fn index_is_owner(&self, owner: &Pubkey, _indexer: ()) -> CruiserResult<bool>
indexer’s owner is owner.Source§impl MultiIndexable<AllAny> for CruiserAccountInfo
impl MultiIndexable<AllAny> for CruiserAccountInfo
Source§fn index_is_signer(&self, indexer: AllAny) -> CruiserResult<bool>
fn index_is_signer(&self, indexer: AllAny) -> CruiserResult<bool>
indexer is a signer.Source§fn index_is_writable(&self, indexer: AllAny) -> CruiserResult<bool>
fn index_is_writable(&self, indexer: AllAny) -> CruiserResult<bool>
indexer is writable.Source§fn index_is_owner(&self, owner: &Pubkey, indexer: AllAny) -> CruiserResult<bool>
fn index_is_owner(&self, owner: &Pubkey, indexer: AllAny) -> CruiserResult<bool>
indexer’s owner is owner.Source§impl PartialEq for CruiserAccountInfo
impl PartialEq for CruiserAccountInfo
Source§impl<'a> SafeOwnerChangeAccess<'a> for CruiserAccountInfo
impl<'a> SafeOwnerChangeAccess<'a> for CruiserAccountInfo
Source§impl<'a> SafeReallocAccess<'a> for CruiserAccountInfo
impl<'a> SafeReallocAccess<'a> for CruiserAccountInfo
Source§fn realloc(&self, new_len: usize, zero_init: bool) -> CruiserResult
fn realloc(&self, new_len: usize, zero_init: bool) -> CruiserResult
SafeReallocAccess::realloc_cpi_safe.Source§fn realloc_cpi_safe(&self, new_len: usize, zero_init: bool) -> CruiserResult
fn realloc_cpi_safe(&self, new_len: usize, zero_init: bool) -> CruiserResult
MAX_PERMITTED_DATA_INCREASE.
This limited growth means that a cpi call can never exceed MAX_PERMITTED_DATA_INCREASE.Source§impl SingleIndexable<()> for CruiserAccountInfo
impl SingleIndexable<()> for CruiserAccountInfo
Source§fn index_info(&self, _indexer: ()) -> CruiserResult<&CruiserAccountInfo>
fn index_info(&self, _indexer: ()) -> CruiserResult<&CruiserAccountInfo>
indexerSource§fn index_to_solana_account_meta(
&self,
indexer: I,
) -> CruiserResult<SolanaAccountMeta>where
Self::AccountInfo: AccountInfo,
fn index_to_solana_account_meta(
&self,
indexer: I,
) -> CruiserResult<SolanaAccountMeta>where
Self::AccountInfo: AccountInfo,
indexer to a SolanaAccountMetaSource§impl<'as_info: 'account, 'account> ToSolanaAccountInfoAccess<'as_info, 'account> for CruiserAccountInfo
impl<'as_info: 'account, 'account> ToSolanaAccountInfoAccess<'as_info, 'account> for CruiserAccountInfo
Source§unsafe fn to_solana_account_info(&'account self) -> SolanaAccountInfo<'as_info>
unsafe fn to_solana_account_info(&'account self) -> SolanaAccountInfo<'as_info>
Source§impl ValidateArgument<()> for CruiserAccountInfo
impl ValidateArgument<()> for CruiserAccountInfo
impl Eq for CruiserAccountInfo
impl StructuralPartialEq for CruiserAccountInfo
Auto Trait Implementations§
impl Freeze for CruiserAccountInfo
impl !RefUnwindSafe for CruiserAccountInfo
impl !Send for CruiserAccountInfo
impl !Sync for CruiserAccountInfo
impl Unpin for CruiserAccountInfo
impl !UnwindSafe for CruiserAccountInfo
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Single for Twhere
T: SingleIndexable<()>,
impl<T> Single for Twhere
T: SingleIndexable<()>,
Source§fn info(&self) -> &<T as AccountArgument>::AccountInfo
fn info(&self) -> &<T as AccountArgument>::AccountInfo
Source§impl<T> ToSolanaAccountMeta for T
impl<T> ToSolanaAccountMeta for T
Source§fn to_solana_account_meta(&self) -> AccountMeta
fn to_solana_account_meta(&self) -> AccountMeta
SolanaAccountMeta