LightAccount

Struct LightAccount 

Source
pub struct LightAccount<'a, A: AnchorSerialize + AnchorDeserialize + LightDiscriminator + DataHasher + Default> {
    pub account: A,
    /* private fields */
}

Fields§

§account: A

Implementations§

Source§

impl<'a, A: AnchorSerialize + AnchorDeserialize + LightDiscriminator + DataHasher + Default> LightAccount<'a, A>

Source

pub fn new_init( owner: &'a Pubkey, address: Option<[u8; 32]>, output_state_tree_index: u8, ) -> Self

Source

pub fn new_mut( owner: &'a Pubkey, input_account_meta: &impl CompressedAccountMetaTrait, input_account: A, ) -> Result<Self, LightSdkError>

Source

pub fn new_close( owner: &'a Pubkey, input_account_meta: &impl CompressedAccountMetaTrait, input_account: A, ) -> Result<Self, LightSdkError>

Source

pub fn discriminator(&self) -> &[u8; 8]

Source

pub fn lamports(&self) -> u64

Source

pub fn lamports_mut(&mut self) -> &mut u64

Source

pub fn address(&self) -> &Option<[u8; 32]>

Source

pub fn owner(&self) -> &Pubkey

Source

pub fn in_account_info(&self) -> &Option<InAccountInfo>

Source

pub fn out_account_info(&mut self) -> &Option<OutAccountInfo>

Source

pub fn to_account_info(self) -> Result<CompressedAccountInfo, LightSdkError>

  1. Serializes the account data and sets the output data hash.
  2. Returns CompressedAccountInfo.

Note this is an expensive operation that should only be called once per instruction.

Trait Implementations§

Source§

impl<'a, A: Debug + AnchorSerialize + AnchorDeserialize + LightDiscriminator + DataHasher + Default> Debug for LightAccount<'a, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: AnchorSerialize + AnchorDeserialize + LightDiscriminator + DataHasher + Default> Deref for LightAccount<'_, A>

Source§

type Target = A

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<A: AnchorSerialize + AnchorDeserialize + LightDiscriminator + DataHasher + Default> DerefMut for LightAccount<'_, A>

Source§

fn deref_mut(&mut self) -> &mut <Self as Deref>::Target

Mutably dereferences the value.
Source§

impl<'a, A: PartialEq + AnchorSerialize + AnchorDeserialize + LightDiscriminator + DataHasher + Default> PartialEq for LightAccount<'a, A>

Source§

fn eq(&self, other: &LightAccount<'a, A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, A: AnchorSerialize + AnchorDeserialize + LightDiscriminator + DataHasher + Default> StructuralPartialEq for LightAccount<'a, A>

Auto Trait Implementations§

§

impl<'a, A> Freeze for LightAccount<'a, A>
where A: Freeze,

§

impl<'a, A> RefUnwindSafe for LightAccount<'a, A>
where A: RefUnwindSafe,

§

impl<'a, A> Send for LightAccount<'a, A>
where A: Send,

§

impl<'a, A> Sync for LightAccount<'a, A>
where A: Sync,

§

impl<'a, A> Unpin for LightAccount<'a, A>
where A: Unpin,

§

impl<'a, A> UnwindSafe for LightAccount<'a, A>
where A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V