Struct spl_token_2022::extension::StateWithExtensions
source · pub struct StateWithExtensions<'data, S: BaseState> {
pub base: S,
/* private fields */
}
Expand description
Encapsulates immutable base state data (mint or account) with possible extensions
Fields
base: S
Unpacked base data
Implementations
sourceimpl<'data, S: BaseState> StateWithExtensions<'data, S>
impl<'data, S: BaseState> StateWithExtensions<'data, S>
sourcepub fn unpack(input: &'data [u8]) -> Result<Self, ProgramError>
pub fn unpack(input: &'data [u8]) -> Result<Self, ProgramError>
Unpack base state, leaving the extension data as a slice
Fails if the base state is not initialized.
Trait Implementations
sourceimpl<'a, S: BaseState> BaseStateWithExtensions<S> for StateWithExtensions<'a, S>
impl<'a, S: BaseState> BaseStateWithExtensions<S> for StateWithExtensions<'a, S>
sourcefn get_tlv_data(&self) -> &[u8] ⓘ
fn get_tlv_data(&self) -> &[u8] ⓘ
Get the buffer containing all extension data
sourcefn get_extension<V: Extension>(&self) -> Result<&V, ProgramError>
fn get_extension<V: Extension>(&self) -> Result<&V, ProgramError>
Unpack a portion of the TLV data as the desired type
sourcefn get_extension_types(&self) -> Result<Vec<ExtensionType>, ProgramError>
fn get_extension_types(&self) -> Result<Vec<ExtensionType>, ProgramError>
Iterates through the TLV entries, returning only the types
sourcefn get_first_extension_type(
&self
) -> Result<Option<ExtensionType>, ProgramError>
fn get_first_extension_type(
&self
) -> Result<Option<ExtensionType>, ProgramError>
Get just the first extension type, useful to track mixed initializations
sourceimpl<'data, S: Debug + BaseState> Debug for StateWithExtensions<'data, S>
impl<'data, S: Debug + BaseState> Debug for StateWithExtensions<'data, S>
sourceimpl<'data, S: PartialEq + BaseState> PartialEq<StateWithExtensions<'data, S>> for StateWithExtensions<'data, S>
impl<'data, S: PartialEq + BaseState> PartialEq<StateWithExtensions<'data, S>> for StateWithExtensions<'data, S>
sourcefn eq(&self, other: &StateWithExtensions<'data, S>) -> bool
fn eq(&self, other: &StateWithExtensions<'data, S>) -> bool
impl<'data, S: BaseState> StructuralPartialEq for StateWithExtensions<'data, S>
Auto Trait Implementations
impl<'data, S> RefUnwindSafe for StateWithExtensions<'data, S>where
S: RefUnwindSafe,
impl<'data, S> Send for StateWithExtensions<'data, S>where
S: Send,
impl<'data, S> Sync for StateWithExtensions<'data, S>where
S: Sync,
impl<'data, S> Unpin for StateWithExtensions<'data, S>where
S: Unpin,
impl<'data, S> UnwindSafe for StateWithExtensions<'data, S>where
S: UnwindSafe,
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more