Skip to main content

ProgramState

Struct ProgramState 

Source
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>

Source

pub fn try_from( program_id: &Pubkey, info: &AccountInfo<'a>, ) -> Result<ProgramState<'a, T>, ProgramError>

Deserializes the given info into a ProgramState.

Source

pub fn seed() -> &'static str

Source

pub fn address(program_id: &Pubkey) -> Pubkey

Trait Implementationsยง

Sourceยง

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>

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 more
Sourceยง

impl<'info, T: AccountSerialize + AccountDeserialize + Clone> AccountsExit<'info> for ProgramState<'info, T>

Sourceยง

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>

Sourceยง

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>

Sourceยง

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<'a, T: AccountSerialize + AccountDeserialize + Clone> Deref for ProgramState<'a, T>

Sourceยง

type Target = T

The resulting type after dereferencing.
Sourceยง

fn deref(&self) -> &Self::Target

Dereferences the value.
Sourceยง

impl<'a, T: AccountSerialize + AccountDeserialize + Clone> DerefMut for ProgramState<'a, T>

Sourceยง

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Sourceยง

impl<'info, T> From<CpiAccount<'info, T>> for ProgramState<'info, T>

Sourceยง

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>

Sourceยง

fn key(&self) -> Pubkey

Sourceยง

impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountInfo<'info> for ProgramState<'info, T>

Sourceยง

impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountInfos<'info> for ProgramState<'info, T>

Sourceยง

impl<'info, T: AccountSerialize + AccountDeserialize + Clone> ToAccountMetas for ProgramState<'info, T>

Sourceยง

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>
where Box<Inner<'info, T>>: Freeze,

ยง

impl<'info, T> Unpin for ProgramState<'info, T>
where Box<Inner<'info, T>>: Unpin,

ยง

impl<'info, T> UnsafeUnpin for ProgramState<'info, T>
where Box<Inner<'info, T>>: UnsafeUnpin,

Blanket Implementationsยง

Sourceยง

impl<T> AbiExample for T

Sourceยง

default fn example() -> T

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Sourceยง

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> IntoEither for T

Sourceยง

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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ“˜
where F: FnOnce(&Self) -> bool,

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
Sourceยง

impl<T> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Sourceยง

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Sourceยง

type Target = T

๐Ÿ”ฌThis is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = !

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Sourceยง

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Sourceยง

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V