pub enum TokenProgramKind {
Spl,
Token2022,
}Expand description
Which token program owns this account.
Variants§
Spl
SPL Token (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA).
Token2022
SPL Token-2022 (TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb).
Implementations§
Source§impl TokenProgramKind
impl TokenProgramKind
Sourcepub const fn program_id(self) -> &'static Address
pub const fn program_id(self) -> &'static Address
Resolve the program-id address backing this kind.
Sourcepub fn from_owner(owner: &Address) -> Result<TokenProgramKind, ProgramError>
pub fn from_owner(owner: &Address) -> Result<TokenProgramKind, ProgramError>
Match an account’s owner against the two supported programs.
Returns Err(IncorrectProgramId) if the account is owned by
any other program.
Sourcepub fn for_account(view: &AccountView) -> Result<TokenProgramKind, ProgramError>
pub fn for_account(view: &AccountView) -> Result<TokenProgramKind, ProgramError>
Resolve the kind from an AccountView using its owner.
Wrapper over AccountView::owned_by that stays on the safe
(no-unsafe) side of the runtime API surface.
Trait Implementations§
Source§impl Clone for TokenProgramKind
impl Clone for TokenProgramKind
Source§fn clone(&self) -> TokenProgramKind
fn clone(&self) -> TokenProgramKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenProgramKind
impl Debug for TokenProgramKind
Source§impl PartialEq for TokenProgramKind
impl PartialEq for TokenProgramKind
Source§fn eq(&self, other: &TokenProgramKind) -> bool
fn eq(&self, other: &TokenProgramKind) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for TokenProgramKind
impl Eq for TokenProgramKind
impl StructuralPartialEq for TokenProgramKind
Auto Trait Implementations§
impl Freeze for TokenProgramKind
impl RefUnwindSafe for TokenProgramKind
impl Send for TokenProgramKind
impl Sync for TokenProgramKind
impl Unpin for TokenProgramKind
impl UnsafeUnpin for TokenProgramKind
impl UnwindSafe for TokenProgramKind
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