#[repr(C)]pub struct SplTokenAccount {
pub mint: [u8; 32],
pub owner: [u8; 32],
pub amount: [u8; 8],
pub delegate_tag: [u8; 4],
pub delegate: [u8; 32],
pub state: u8,
pub is_native_tag: [u8; 4],
pub native_amount: [u8; 8],
pub delegated_amount: [u8; 8],
pub close_authority_tag: [u8; 4],
pub close_authority: [u8; 32],
}Expand description
Zero-copy overlay for an SPL Token account (165 bytes).
Layout:
0..32 mint [u8; 32]
32..64 owner [u8; 32]
64..72 amount [u8; 8] (u64 LE)
72..76 delegate_tag [u8; 4] (u32 LE: 0=None, 1=Some)
76..108 delegate [u8; 32]
108..109 state u8 (0=uninit, 1=init, 2=frozen)
109..113 is_native_tag [u8; 4] (u32 LE: 0=None, 1=Some)
113..121 native_amount [u8; 8] (u64 LE)
121..129 delegated_amt [u8; 8] (u64 LE)
129..133 close_auth_tag [u8; 4] (u32 LE: 0=None, 1=Some)
133..165 close_auth [u8; 32]Fields§
§mint: [u8; 32]Mint address associated with this token account.
owner: [u8; 32]Owner of this token account.
amount: [u8; 8]Token balance (u64 LE).
delegate_tag: [u8; 4]Delegate option tag (u32 LE: 0=None, 1=Some).
delegate: [u8; 32]Delegate address (valid only if delegate_tag == 1).
state: u8Account state: 0=Uninitialized, 1=Initialized, 2=Frozen.
is_native_tag: [u8; 4]Is-native option tag (u32 LE).
native_amount: [u8; 8]Native SOL amount (u64 LE, valid only if is_native_tag == 1).
delegated_amount: [u8; 8]Delegated amount (u64 LE).
Close authority option tag (u32 LE).
Close authority address (valid only if close_authority_tag == 1).
Implementations§
Source§impl SplTokenAccount
impl SplTokenAccount
Sourcepub fn has_delegate(&self) -> bool
pub fn has_delegate(&self) -> bool
Check whether a delegate is set.
Check whether a close authority is set.
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if the account is initialized.
Trait Implementations§
Source§impl Clone for SplTokenAccount
impl Clone for SplTokenAccount
Source§fn clone(&self) -> SplTokenAccount
fn clone(&self) -> SplTokenAccount
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl FixedLayout for SplTokenAccount
impl FixedLayout for SplTokenAccount
impl Copy for SplTokenAccount
impl Pod for SplTokenAccount
Auto Trait Implementations§
impl Freeze for SplTokenAccount
impl RefUnwindSafe for SplTokenAccount
impl Send for SplTokenAccount
impl Sync for SplTokenAccount
impl Unpin for SplTokenAccount
impl UnsafeUnpin for SplTokenAccount
impl UnwindSafe for SplTokenAccount
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