Enum spl_tlv_account_resolution::seeds::Seed
source · pub enum Seed {
Uninitialized,
Literal {
bytes: Vec<u8>,
},
InstructionData {
index: u8,
length: u8,
},
AccountKey {
index: u8,
},
AccountData {
account_index: u8,
data_index: u8,
length: u8,
},
}
Expand description
Enum to describe a required seed for a Program-Derived Address
Variants§
Uninitialized
Uninitialized configuration byte space
Literal
A literal hard-coded argument Packed as: * 1 - Discriminator * 1 - Length of literal * N - Literal bytes themselves
Fields
InstructionData
An instruction-provided argument, to be resolved from the instruction data Packed as: * 1 - Discriminator * 1 - Start index of instruction data * 1 - Length of instruction data starting at index
Fields
AccountKey
The public key of an account from the entire accounts list. Note: This includes an extra accounts required.
Packed as: * 1 - Discriminator * 1 - Index of account in accounts list
AccountData
An argument to be resolved from the inner data of some account Packed as: * 1 - Discriminator * 1 - Index of account in accounts list * 1 - Start index of account data * 1 - Length of account data starting at index
Implementations§
source§impl Seed
impl Seed
sourcepub fn pack(&self, dst: &mut [u8]) -> Result<(), ProgramError>
pub fn pack(&self, dst: &mut [u8]) -> Result<(), ProgramError>
Packs a seed configuration into a slice
sourcepub fn pack_into_address_config(
seeds: &[Self],
) -> Result<[u8; 32], ProgramError>
pub fn pack_into_address_config( seeds: &[Self], ) -> Result<[u8; 32], ProgramError>
Packs a vector of seed configurations into a 32-byte array, filling the rest with 0s. Errors if it overflows.
sourcepub fn unpack(bytes: &[u8]) -> Result<Self, ProgramError>
pub fn unpack(bytes: &[u8]) -> Result<Self, ProgramError>
Unpacks a seed configuration from a slice
sourcepub fn unpack_address_config(
address_config: &[u8; 32],
) -> Result<Vec<Self>, ProgramError>
pub fn unpack_address_config( address_config: &[u8; 32], ) -> Result<Vec<Self>, ProgramError>
Unpacks all seed configurations from a 32-byte array. Stops when it hits uninitialized data (0s).
Trait Implementations§
source§impl PartialEq for Seed
impl PartialEq for Seed
impl StructuralPartialEq for Seed
Auto Trait Implementations§
impl Freeze for Seed
impl RefUnwindSafe for Seed
impl Send for Seed
impl Sync for Seed
impl Unpin for Seed
impl UnwindSafe for Seed
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
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>
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>
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