#[repr(C)]pub struct Mint {
pub base: BaseMint,
pub metadata: MintMetadata,
pub reserved: [u8; 16],
pub account_type: u8,
pub compression: CompressionInfo,
pub extensions: Option<Vec<ExtensionStruct>>,
}Fields§
§base: BaseMint§metadata: MintMetadata§reserved: [u8; 16]Reserved bytes (16 bytes) for T22 layout compatibility.
Positions account_type at offset 165: 82 (BaseMint) + 67 (metadata) + 16 (reserved) = 165.
account_type: u8Account type discriminator at byte offset 165 (1 = Mint, 2 = Account)
compression: CompressionInfoCompression info embedded directly in the mint
extensions: Option<Vec<ExtensionStruct>>Implementations§
Source§impl Mint
impl Mint
pub fn hash(&self) -> Result<[u8; 32], TokenError>
Sourcepub fn from_account_info_checked(
account_info: &AccountInfo,
) -> Result<Self, TokenError>
pub fn from_account_info_checked( account_info: &AccountInfo, ) -> Result<Self, TokenError>
Deserialize a Mint from a Solana account with validation.
Checks:
- Account is owned by the specified program
- Account is initialized (BaseMint.is_initialized == true)
Note: Mint accounts follow SPL token mint pattern (no discriminator). Validation is done via owner check + PDA derivation (caller responsibility).
Sourcepub fn is_mint_account(&self) -> bool
pub fn is_mint_account(&self) -> bool
Checks if account_type matches Mint discriminator value
Source§impl Mint
impl Mint
Sourcepub fn zero_copy_at_checked(
bytes: &[u8],
) -> Result<(ZMint<'_>, &[u8]), TokenError>
pub fn zero_copy_at_checked( bytes: &[u8], ) -> Result<(ZMint<'_>, &[u8]), TokenError>
Zero-copy deserialization with initialization and account_type check. Returns an error if:
- Account is not initialized (is_initialized == false)
- Account type is not ACCOUNT_TYPE_MINT (byte 165 != 1)
Sourcepub fn zero_copy_at_mut_checked(
bytes: &mut [u8],
) -> Result<(ZMintMut<'_>, &mut [u8]), TokenError>
pub fn zero_copy_at_mut_checked( bytes: &mut [u8], ) -> Result<(ZMintMut<'_>, &mut [u8]), TokenError>
Mutable zero-copy deserialization with initialization and account_type check. Returns an error if:
- Account is not initialized (is_initialized == false)
- Account type is not ACCOUNT_TYPE_MINT
Trait Implementations§
Source§impl BorshDeserialize for Mint
impl BorshDeserialize for Mint
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Mint
impl BorshSerialize for Mint
Source§impl<'a> TryFrom<&ZMintInstructionData<'a>> for Mint
impl<'a> TryFrom<&ZMintInstructionData<'a>> for Mint
Source§type Error = TokenError
type Error = TokenError
The type returned in the event of a conversion error.
Source§impl TryFrom<Mint> for MintInstructionData
impl TryFrom<Mint> for MintInstructionData
Source§impl<'a> ZeroCopyAt<'a> for Mint
impl<'a> ZeroCopyAt<'a> for Mint
type ZeroCopyAt = ZMint<'a>
fn zero_copy_at( bytes: &'a [u8], ) -> Result<(Self::ZeroCopyAt, &'a [u8]), ZeroCopyError>
Source§impl<'a> ZeroCopyAtMut<'a> for Mint
impl<'a> ZeroCopyAtMut<'a> for Mint
type ZeroCopyAtMut = ZMintMut<'a>
fn zero_copy_at_mut( bytes: &'a mut [u8], ) -> Result<(Self::ZeroCopyAtMut, &'a mut [u8]), ZeroCopyError>
Source§impl<'a> ZeroCopyNew<'a> for Mint
impl<'a> ZeroCopyNew<'a> for Mint
Source§type ZeroCopyConfig = MintConfig
type ZeroCopyConfig = MintConfig
Configuration type needed to initialize this type
Source§fn byte_len(config: &Self::ZeroCopyConfig) -> Result<usize, ZeroCopyError>
fn byte_len(config: &Self::ZeroCopyConfig) -> Result<usize, ZeroCopyError>
Calculate the byte length needed for this type with the given configuration Read more
Source§fn new_zero_copy(
bytes: &'a mut [u8],
config: Self::ZeroCopyConfig,
) -> Result<(Self::Output, &'a mut [u8]), ZeroCopyError>
fn new_zero_copy( bytes: &'a mut [u8], config: Self::ZeroCopyConfig, ) -> Result<(Self::Output, &'a mut [u8]), ZeroCopyError>
Initialize this type in a mutable byte slice with the given configuration Read more
impl Eq for Mint
impl StructuralPartialEq for Mint
Auto Trait Implementations§
impl Freeze for Mint
impl RefUnwindSafe for Mint
impl Send for Mint
impl Sync for Mint
impl Unpin for Mint
impl UnwindSafe for Mint
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> HashToFieldSize for Twhere
T: BorshSerialize,
impl<T> HashToFieldSize for Twhere
T: BorshSerialize,
fn hash_to_field_size(&self) -> Result<[u8; 32], HasherError>
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