pub struct StateWithExtensionsOwned<S: BaseState> {
pub base: S,
/* private fields */
}
Expand description
Encapsulates owned immutable base state data (mint or account) with possible extensions
Fields§
§base: S
Unpacked base data
Implementations§
Trait Implementations§
Source§impl<S: BaseState> BaseStateWithExtensions<S> for StateWithExtensionsOwned<S>
impl<S: BaseState> BaseStateWithExtensions<S> for StateWithExtensionsOwned<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_bytes<V: Extension>(&self) -> Result<&[u8], ProgramError>
fn get_extension_bytes<V: Extension>(&self) -> Result<&[u8], ProgramError>
Fetch the bytes for a TLV entry
Source§fn get_extension<V: Extension + Pod>(&self) -> Result<&V, ProgramError>
fn get_extension<V: Extension + Pod>(&self) -> Result<&V, ProgramError>
Unpack a portion of the TLV data as the desired type
Source§fn get_variable_len_extension<V: Extension + VariableLenPack>(
&self,
) -> Result<V, ProgramError>
fn get_variable_len_extension<V: Extension + VariableLenPack>( &self, ) -> Result<V, ProgramError>
Unpacks a portion of the TLV data as the desired variable-length 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§fn try_get_account_len(&self) -> Result<usize, ProgramError>
fn try_get_account_len(&self) -> Result<usize, ProgramError>
Get the total number of bytes used by TLV entries and the base type
Source§fn try_get_new_account_len<V: Extension + Pod>(
&self,
) -> Result<usize, ProgramError>
fn try_get_new_account_len<V: Extension + Pod>( &self, ) -> Result<usize, ProgramError>
Calculate the new expected size if the state allocates the given
fixed-length extension instance.
If the state already has the extension, the resulting account length
will be unchanged.
Source§fn try_get_new_account_len_for_variable_len_extension<V: Extension + VariableLenPack>(
&self,
new_extension: &V,
) -> Result<usize, ProgramError>
fn try_get_new_account_len_for_variable_len_extension<V: Extension + VariableLenPack>( &self, new_extension: &V, ) -> Result<usize, ProgramError>
Calculate the new expected size if the state allocates the given
variable-length extension instance.
Source§impl<S: Clone + BaseState> Clone for StateWithExtensionsOwned<S>
impl<S: Clone + BaseState> Clone for StateWithExtensionsOwned<S>
Source§fn clone(&self) -> StateWithExtensionsOwned<S>
fn clone(&self) -> StateWithExtensionsOwned<S>
Returns a copy 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 moreimpl<S: BaseState> StructuralPartialEq for StateWithExtensionsOwned<S>
Auto Trait Implementations§
impl<S> Freeze for StateWithExtensionsOwned<S>where
S: Freeze,
impl<S> RefUnwindSafe for StateWithExtensionsOwned<S>where
S: RefUnwindSafe,
impl<S> Send for StateWithExtensionsOwned<S>where
S: Send,
impl<S> Sync for StateWithExtensionsOwned<S>where
S: Sync,
impl<S> Unpin for StateWithExtensionsOwned<S>where
S: Unpin,
impl<S> UnwindSafe for StateWithExtensionsOwned<S>where
S: UnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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