pub struct TokenExtensionsProgramDataAccount<'a, const WRITE: bool, T: BaseState + Pack>(/* private fields */);Expand description
Wrapper for DataAccount that deserializes data with BaseState for either SPL Token or SPL Token Extensions program.
§Notes
It is recommended to use either StateWithExtensions or PodStateWithExtensions by borrowing account data from either ReadonlyTokenProgramAccount or WritableTokenProgramAccount instead of using this type. But if all you need is the base state, this type is sufficient.
Methods from Deref<Target = DataAccount<'a, WRITE, 0, StateWithExtensionsBaseSchema<T>>>§
Sourcepub fn try_write_data(&self) -> ProgramResult
pub fn try_write_data(&self) -> ProgramResult
Write the data to the account.
Methods from Deref<Target = Account<'a, WRITE>>§
pub fn try_close(&self, beneficiary: &Account<'a, true>) -> ProgramResult
Methods from Deref<Target = NoStdAccountInfo>§
Sourcepub fn to_info_c(&self) -> AccountInfoC
pub fn to_info_c(&self) -> AccountInfoC
CPI utility function
Sourcepub fn to_meta_c(&self) -> AccountMetaC
pub fn to_meta_c(&self) -> AccountMetaC
CPI utility function
Sourcepub fn to_meta_c_signer(&self) -> AccountMetaC
pub fn to_meta_c_signer(&self) -> AccountMetaC
CPI utility function.
Intended for pdas that did not sign transaction but need to sign for cpi.
pub fn key(&self) -> &Pubkey
pub fn owner(&self) -> &Pubkey
pub fn is_signer(&self) -> bool
pub fn is_writable(&self) -> bool
pub fn executable(&self) -> bool
pub fn data_len(&self) -> usize
Sourcepub unsafe fn unchecked_borrow_lamports(&self) -> &u64
pub unsafe fn unchecked_borrow_lamports(&self) -> &u64
§Safety
This does not check or modify the 4-bit refcell. Useful when instruction has verified non-duplicate accounts.
Sourcepub unsafe fn unchecked_borrow_mut_lamports(&self) -> &mut u64
pub unsafe fn unchecked_borrow_mut_lamports(&self) -> &mut u64
§Safety
This does not check or modify the 4-bit refcell. Useful when instruction has verified non-duplicate accounts.
Sourcepub unsafe fn unchecked_borrow_data(&self) -> &[u8] ⓘ
pub unsafe fn unchecked_borrow_data(&self) -> &[u8] ⓘ
§Safety
This does not check or modify the 4-bit refcell. Useful when instruction has verified non-duplicate accounts.
Sourcepub unsafe fn unchecked_borrow_mut_data(&self) -> &mut [u8] ⓘ
pub unsafe fn unchecked_borrow_mut_data(&self) -> &mut [u8] ⓘ
§Safety
This does not check or modify the 4-bit refcell. Useful when instruction has verified non-duplicate accounts.
Sourcepub fn try_borrow_lamports(&self) -> Result<Ref<'_, u64>, ProgramError>
pub fn try_borrow_lamports(&self) -> Result<Ref<'_, u64>, ProgramError>
Tries to get a read only reference to the lamport field, failing if the field is already mutable borrowed or if 7 borrows already exist.
Sourcepub fn try_borrow_mut_lamports(&self) -> Result<RefMut<'_, u64>, ProgramError>
pub fn try_borrow_mut_lamports(&self) -> Result<RefMut<'_, u64>, ProgramError>
Tries to get a read only reference to the lamport field, failing if the field is already borrowed in any form.
Sourcepub fn try_borrow_data(&self) -> Result<Ref<'_, [u8]>, ProgramError>
pub fn try_borrow_data(&self) -> Result<Ref<'_, [u8]>, ProgramError>
Tries to get a read only reference to the data field, failing if the field is already mutable borrowed or if 7 borrows already exist.
Sourcepub fn try_borrow_mut_data(&self) -> Result<RefMut<'_, [u8]>, ProgramError>
pub fn try_borrow_mut_data(&self) -> Result<RefMut<'_, [u8]>, ProgramError>
Tries to get a read only reference to the data field, failing if the field is already borrowed in any form.
Sourcepub fn realloc(
&self,
new_len: usize,
zero_init: bool,
) -> Result<(), ProgramError>
pub fn realloc( &self, new_len: usize, zero_init: bool, ) -> Result<(), ProgramError>
Realloc the account’s data and optionally zero-initialize the new memory.
Note: Account data can be increased within a single call by up to
solana_program::entrypoint::MAX_PERMITTED_DATA_INCREASE bytes.
Note: Memory used to grow is already zero-initialized upon program
entrypoint and re-zeroing it wastes compute units. If within the same
call a program reallocs from larger to smaller and back to larger again
the new space could contain stale data. Pass true for zero_init in
this case, otherwise compute units will be wasted re-zero-initializing.
§Safety
This method makes assumptions about the layout and location of memory
referenced by AccountInfo fields. It should only be called for
instances of AccountInfo that were created by the runtime and received
in the process_instruction entrypoint of a program.
pub fn reassign(&self, new_owner: &Pubkey)
Trait Implementations§
Source§impl<'a, const WRITE: bool, T: Clone + BaseState + Pack> Clone for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T: Clone + BaseState + Pack> Clone for TokenExtensionsProgramDataAccount<'a, WRITE, T>
Source§impl<'a, const WRITE: bool, T: BaseState + Pack> Deref for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T: BaseState + Pack> Deref for TokenExtensionsProgramDataAccount<'a, WRITE, T>
Source§type Target = DataAccount<'a, WRITE, 0, StateWithExtensionsBaseSchema<T>>
type Target = DataAccount<'a, WRITE, 0, StateWithExtensionsBaseSchema<T>>
impl<'a, const WRITE: bool, T: Eq + BaseState + Pack> Eq for TokenExtensionsProgramDataAccount<'a, WRITE, T>
Source§impl<'a, const WRITE: bool, T: PartialEq + BaseState + Pack> PartialEq for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T: PartialEq + BaseState + Pack> PartialEq for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T: PartialEq + BaseState + Pack> StructuralPartialEq for TokenExtensionsProgramDataAccount<'a, WRITE, T>
Source§impl<'a, const WRITE: bool, T: BaseState + Pack> TryFrom<&'a NoStdAccountInfo> for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T: BaseState + Pack> TryFrom<&'a NoStdAccountInfo> for TokenExtensionsProgramDataAccount<'a, WRITE, T>
Source§type Error = SealevelToolsError<'static>
type Error = SealevelToolsError<'static>
Auto Trait Implementations§
impl<'a, const WRITE: bool, T> !Send for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T> !Sync for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T> Freeze for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T> RefUnwindSafe for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T> Unpin for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T> UnsafeUnpin for TokenExtensionsProgramDataAccount<'a, WRITE, T>
impl<'a, const WRITE: bool, T> UnwindSafe for TokenExtensionsProgramDataAccount<'a, WRITE, T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more