pub struct ProgramAccount<'a, T: Pod + FixedLayout> { /* private fields */ }Expand description
A generic program-owned account.
Unlike HopperAccount<T> which validates against the executing program,
ProgramAccount<T> validates against an arbitrary expected owner.
Used for external program accounts (token accounts, mints, etc.).
Implementations§
Source§impl<'a, T: Pod + FixedLayout> ProgramAccount<'a, T>
impl<'a, T: Pod + FixedLayout> ProgramAccount<'a, T>
Sourcepub fn from_account(
account: &'a AccountView,
expected_owner: &Address,
) -> Result<Self, ProgramError>
pub fn from_account( account: &'a AccountView, expected_owner: &Address, ) -> Result<Self, ProgramError>
Construct from an AccountView, validating the owner.
Sourcepub fn from_account_unchecked(account: &'a AccountView) -> Self
pub fn from_account_unchecked(account: &'a AccountView) -> Self
Construct without owner validation (caller’s responsibility).
Sourcepub fn read(&self) -> Result<VerifiedAccount<'a, T>, ProgramError>
pub fn read(&self) -> Result<VerifiedAccount<'a, T>, ProgramError>
Sourcepub fn to_account_view(&self) -> &'a AccountView
pub fn to_account_view(&self) -> &'a AccountView
The underlying AccountView.
Auto Trait Implementations§
impl<'a, T> Freeze for ProgramAccount<'a, T>
impl<'a, T> RefUnwindSafe for ProgramAccount<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for ProgramAccount<'a, T>where
T: Send,
impl<'a, T> Sync for ProgramAccount<'a, T>where
T: Sync,
impl<'a, T> Unpin for ProgramAccount<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for ProgramAccount<'a, T>
impl<'a, T> UnwindSafe for ProgramAccount<'a, T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more