pub trait BaseStateWithExtensions<S: BaseState> {
// Required method
fn get_tlv_data(&self) -> &[u8] ⓘ;
// Provided methods
fn get_extension<V: Extension>(&self) -> Result<&V, ProgramError> { ... }
fn get_extension_types(&self) -> Result<Vec<ExtensionType>, ProgramError> { ... }
fn get_first_extension_type(
&self
) -> Result<Option<ExtensionType>, ProgramError> { ... }
}
Expand description
Trait for base state with extension
Required Methods§
sourcefn get_tlv_data(&self) -> &[u8] ⓘ
fn get_tlv_data(&self) -> &[u8] ⓘ
Get the buffer containing all extension data
Provided Methods§
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