Struct safe_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§
source§impl<'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§
source§impl<'a, S: BaseState> BaseStateWithExtensions<S> for StateWithExtensions<'a, S>
impl<'a, S: BaseState> BaseStateWithExtensions<S> for StateWithExtensions<'a, S>
source§fn get_tlv_data(&self) -> &[u8] ⓘ
fn get_tlv_data(&self) -> &[u8] ⓘ
Get the buffer containing all extension data
source§fn 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
source§fn 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
source§fn 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
source§impl<'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>
source§fn eq(&self, other: &StateWithExtensions<'data, S>) -> bool
fn eq(&self, other: &StateWithExtensions<'data, S>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.