pub struct ProgramState<'info, T: AccountSerialize + AccountDeserialize + Clone> { /* private fields */ }๐Deprecated
Expand description
Boxed container for the program state singleton.
Implementationsยง
Sourceยงimpl<'a, T: AccountSerialize + AccountDeserialize + Clone> ProgramState<'a, T>
impl<'a, T: AccountSerialize + AccountDeserialize + Clone> ProgramState<'a, T>
Sourcepub fn try_from(
program_id: &Pubkey,
info: &AccountInfo<'a>,
) -> Result<ProgramState<'a, T>, ProgramError>
pub fn try_from( program_id: &Pubkey, info: &AccountInfo<'a>, ) -> Result<ProgramState<'a, T>, ProgramError>
Deserializes the given info into a ProgramState.
pub fn seed() -> &'static str
pub fn address(program_id: &Pubkey) -> Pubkey
Trait Implementationsยง
Sourceยงimpl<'info, T> Accounts<'info> for ProgramState<'info, T>
impl<'info, T> Accounts<'info> for ProgramState<'info, T>
Sourceยงfn try_accounts(
program_id: &Pubkey,
accounts: &mut &[AccountInfo<'info>],
_ix_data: &[u8],
) -> Result<Self, ProgramError>
fn try_accounts( program_id: &Pubkey, accounts: &mut &[AccountInfo<'info>], _ix_data: &[u8], ) -> Result<Self, ProgramError>
Returns the validated accounts struct. What constitutes โvalidโ is
program dependent. However, users of these types should never have to
worry about account substitution attacks. For example, if a program
expects a
Mint account from the SPL token program in a particular
field, then it should be impossible for this method to return Ok if
any other account type is givenโfrom the SPL token program or elsewhere. Read moreSourceยงimpl<'info, T: AccountSerialize + AccountDeserialize + Clone> AccountsExit<'info> for ProgramState<'info, T>
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> AccountsExit<'info> for ProgramState<'info, T>
Sourceยงfn exit(&self, _program_id: &Pubkey) -> ProgramResult
fn exit(&self, _program_id: &Pubkey) -> ProgramResult
program_id is the currently executing program.Sourceยงimpl<'info, T: AccountSerialize + AccountDeserialize + Clone> AsRef<AccountInfo<'info>> for ProgramState<'info, T>
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> AsRef<AccountInfo<'info>> for ProgramState<'info, T>
Sourceยงfn as_ref(&self) -> &AccountInfo<'info>
fn as_ref(&self) -> &AccountInfo<'info>
Converts this type into a shared reference of the (usually inferred) input type.
Sourceยงimpl<'info, T: Clone + AccountSerialize + AccountDeserialize + Clone> Clone for ProgramState<'info, T>
impl<'info, T: Clone + AccountSerialize + AccountDeserialize + Clone> Clone for ProgramState<'info, T>
Sourceยงimpl<'a, T: AccountSerialize + AccountDeserialize + Clone> Deref for ProgramState<'a, T>
impl<'a, T: AccountSerialize + AccountDeserialize + Clone> Deref for ProgramState<'a, T>
Sourceยงimpl<'a, T: AccountSerialize + AccountDeserialize + Clone> DerefMut for ProgramState<'a, T>
impl<'a, T: AccountSerialize + AccountDeserialize + Clone> DerefMut for ProgramState<'a, T>
Sourceยงimpl<'info, T> From<CpiAccount<'info, T>> for ProgramState<'info, T>
impl<'info, T> From<CpiAccount<'info, T>> for ProgramState<'info, T>
Sourceยงfn from(a: CpiAccount<'info, T>) -> Self
fn from(a: CpiAccount<'info, T>) -> Self
Converts to this type from the input type.
Sourceยงimpl<'info, T: AccountSerialize + AccountDeserialize + Clone> Key for ProgramState<'info, T>
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> Key for ProgramState<'info, T>
Sourceยงimpl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountInfo<'info> for ProgramState<'info, T>
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountInfo<'info> for ProgramState<'info, T>
fn to_account_info(&self) -> AccountInfo<'info>
Sourceยงimpl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountInfos<'info> for ProgramState<'info, T>
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountInfos<'info> for ProgramState<'info, T>
fn to_account_infos(&self) -> Vec<AccountInfo<'info>>
Sourceยงimpl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountMetas for ProgramState<'info, T>
impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountMetas for ProgramState<'info, T>
Sourceยงfn to_account_metas(&self, is_signer: Option<bool>) -> Vec<AccountMeta>
fn to_account_metas(&self, is_signer: Option<bool>) -> Vec<AccountMeta>
is_signer is given as an optional override for the signer meta field.
This covers the edge case when a program-derived-address needs to relay
a transaction from a client to another program but sign the transaction
before the relay. The client cannot mark the field as a signer, and so
we have to override the is_signer meta field given by the client.Auto Trait Implementationsยง
impl<'info, T> !RefUnwindSafe for ProgramState<'info, T>
impl<'info, T> !Send for ProgramState<'info, T>
impl<'info, T> !Sync for ProgramState<'info, T>
impl<'info, T> !UnwindSafe for ProgramState<'info, T>
impl<'info, T> Freeze for ProgramState<'info, T>
impl<'info, T> Unpin for ProgramState<'info, T>
impl<'info, T> UnsafeUnpin for ProgramState<'info, T>where
Box<Inner<'info, T>>: UnsafeUnpin,
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
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> โ
Converts
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> โ
Converts
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