pub struct InterfaceMint<'a> {
pub kind: TokenProgramKind,
/* private fields */
}Expand description
Polymorphic SPL Token / Token-2022 mint overlay.
SPL Mint and Token-2022 base mint share the same first 82 bytes
(mint authority COption, supply, decimals, is_init flag, freeze
authority COption). Token-2022 extension bytes begin at offset
165; this wrapper exposes only the base layout. Use
crate::token2022_ext helpers for extension parsing.
Fields§
§kind: TokenProgramKindWhich program owns the mint.
Implementations§
Source§impl<'a> InterfaceMint<'a>
impl<'a> InterfaceMint<'a>
Sourcepub fn from_data(
data: &'a [u8],
kind: TokenProgramKind,
) -> Result<InterfaceMint<'a>, ProgramError>
pub fn from_data( data: &'a [u8], kind: TokenProgramKind, ) -> Result<InterfaceMint<'a>, ProgramError>
Wrap a previously-borrowed mint body. Caller verifies kind
using TokenProgramKind::for_account.
Sourcepub fn supply(&self) -> Result<u64, ProgramError>
pub fn supply(&self) -> Result<u64, ProgramError>
The mint supply.
Sourcepub fn decimals(&self) -> Result<u8, ProgramError>
pub fn decimals(&self) -> Result<u8, ProgramError>
The mint decimals.
The mint authority, if set.
The freeze authority, if set.
Sourcepub fn assert_initialized(&self) -> Result<(), ProgramError>
pub fn assert_initialized(&self) -> Result<(), ProgramError>
Convenience: assert the mint is initialised.
Trait Implementations§
Source§impl<'a> Clone for InterfaceMint<'a>
impl<'a> Clone for InterfaceMint<'a>
Source§fn clone(&self) -> InterfaceMint<'a>
fn clone(&self) -> InterfaceMint<'a>
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<'a> Debug for InterfaceMint<'a>
impl<'a> Debug for InterfaceMint<'a>
impl<'a> Copy for InterfaceMint<'a>
Auto Trait Implementations§
impl<'a> Freeze for InterfaceMint<'a>
impl<'a> RefUnwindSafe for InterfaceMint<'a>
impl<'a> Send for InterfaceMint<'a>
impl<'a> Sync for InterfaceMint<'a>
impl<'a> Unpin for InterfaceMint<'a>
impl<'a> UnsafeUnpin for InterfaceMint<'a>
impl<'a> UnwindSafe for InterfaceMint<'a>
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