pub struct Instance {
pub discriminator: [u8; 8],
pub components: BTreeMap<Component, ComponentValue>,
pub nonce: u64,
pub instance_authority: Pubkey,
pub bump: u8,
}Fields§
§discriminator: [u8; 8]Identifier for this specific structure
components: BTreeMap<Component, ComponentValue>Source of truth for what the values of the components are
nonce: u64Nonce to allow multiple Instances
Instance authority who has access to state changing operations in this specific Instance
bump: u8Canonical bump for Instances
Implementations§
Source§impl Instance
impl Instance
Sourcepub fn new(
components: BTreeMap<Component, ComponentValue>,
nonce: u64,
instance_authority: Pubkey,
bump: u8,
) -> Self
pub fn new( components: BTreeMap<Component, ComponentValue>, nonce: u64, instance_authority: Pubkey, bump: u8, ) -> Self
Create new Instance state
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Is true if Instances is initialized
Sourcepub fn is_uninitialized(&self) -> bool
pub fn is_uninitialized(&self) -> bool
Is true if Instance is uninitialized
Trait Implementations§
Source§impl BorshDeserialize for Instance
impl BorshDeserialize for Instance
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Instance
impl BorshSerialize for Instance
Source§impl SplDiscriminate for Instance
impl SplDiscriminate for Instance
Source§const SPL_DISCRIMINATOR: ArrayDiscriminator
const SPL_DISCRIMINATOR: ArrayDiscriminator
The 8-byte discriminator as a
[u8; 8]Source§const SPL_DISCRIMINATOR_SLICE: &'static [u8] = _
const SPL_DISCRIMINATOR_SLICE: &'static [u8] = _
The 8-byte discriminator as a slice (
&[u8])impl Eq for Instance
impl StructuralPartialEq for Instance
Auto Trait Implementations§
impl Freeze for Instance
impl RefUnwindSafe for Instance
impl Send for Instance
impl Sync for Instance
impl Unpin for Instance
impl UnwindSafe for Instance
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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