Skip to main content

Asset

Struct Asset 

Source
#[repr(C)]
pub struct Asset { pub discriminator: Discriminator, pub state: State, pub standard: Standard, pub mutable: PodBool, pub owner: Pubkey, pub group: PodOption<NullablePubkey>, pub authority: Pubkey, pub delegate: PodOption<Delegate>, pub name: PodStr<nifty_asset_types::::state::asset::Asset::{constant#0}>, }
Expand description

Asset account (header) information.

Fields§

§discriminator: Discriminator

Account discriminator.

§state: State

State of the asset.

§standard: Standard

Standard of the asset.

§mutable: PodBool

Indicates whether the asset is mutable.

§owner: Pubkey

Current owner (holder) of the asset.

§group: PodOption<NullablePubkey>

Group of the asset.

This is a reference to the asset that represents the group. When the asset is not part of a group, the group is represented by Pubkey::default().

§authority: Pubkey

Authority of the asset.

The authority is the account that can update the metadata of the asset. This is typically the creator of the asset.

§delegate: PodOption<Delegate>

Delegate of the asset.

The delegate is the account that can control the asset on behalf of the owner.

§name: PodStr<nifty_asset_types::::state::asset::Asset::{constant#0}>

Name of the asset.

Implementations§

Source§

impl Asset

Source

pub const LEN: usize

Length of the account data.

Source

pub fn contains(extension_type: ExtensionType, data: &[u8]) -> bool

Indicates whether the account contains an extension of a given type.

Source

pub fn get<'a, T>(data: &'a [u8]) -> Option<T>
where T: ExtensionData<'a>,

Returns the extension data of a given type.

This function will return the first extension of the given type. If the extension is not found, None is returned.

Source

pub fn get_mut<'a, T>(data: &'a mut [u8]) -> Option<T>
where T: ExtensionDataMut<'a>,

Returns a mutable reference to the extension data of a given type.

This function will return the first extension of the given type. If the extension is not found, None is returned.

Source

pub fn get_extensions(data: &[u8]) -> Vec<ExtensionType>

Returns the extensions on the account data.

This function will return a list of ExtensionTypes that are present on the account data.

The account data might have extensions that are not recognized if an older version of the library is used. In this case, this method will only return the list of recognized extensions.

Source

pub fn first_extension(data: &[u8]) -> Option<(&Extension, usize)>

Returns the first extension of the account.

This function will return a tuple containing the extension type and the offset of the extension data. If the account does not contain any extension, None is returned.

Source

pub fn last_extension(data: &[u8]) -> Option<(&Extension, usize)>

Returns the last extension of the account.

This function will return a tuple containing the extension type and the offset of the extension data. If the account does not contain any extension or if it contains an unrecognized extension type, None is returned.

Source

pub fn get_extension( extension_type: ExtensionType, data: &[u8], ) -> Option<(&Extension, usize)>

Returns the extension given its type.

This function will return a tuple containing the extension type and the offset to the extension data. If the account does not contain any extension, None is returned.

Trait Implementations§

Source§

impl Clone for Asset

Source§

fn clone(&self) -> Asset

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 Copy for Asset

Source§

impl Pod for Asset

Source§

impl<'a> ZeroCopy<'a, Asset> for Asset

Default implementation for zero-copy trait.

Source§

fn load(data: &'a [u8]) -> &'a Self

Source§

fn load_mut(data: &'a mut [u8]) -> &'a mut Self

Source§

impl Zeroable for Asset

Source§

fn zeroed() -> Self

Auto Trait Implementations§

§

impl Freeze for Asset

§

impl RefUnwindSafe for Asset

§

impl Send for Asset

§

impl Sync for Asset

§

impl Unpin for Asset

§

impl UnsafeUnpin for Asset

§

impl UnwindSafe for Asset

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> AnyBitPattern for T
where T: Pod,

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> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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> NoUninit for T
where T: Pod,

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<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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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