Skip to main content

PinoContext

Struct PinoContext 

Source
pub struct PinoContext<'a> {
    pub iter: &'a mut Iter<'a, AccountInfo>,
    /* private fields */
}

Fields§

§iter: &'a mut Iter<'a, AccountInfo>

Implementations§

Source§

impl<'a> PinoContext<'a>

Source

pub fn new(iter: &'a mut Iter<'a, AccountInfo>) -> Self

Source

pub fn next<T: PinoAccount>(&mut self) -> Result<T, ProgramError>

Pull the next AccountInfo and load as T

Source

pub fn next_mut<T: PinoAccount>( &mut self, ) -> Result<(T, &'a AccountInfo), ProgramError>

Pull the next AccountInfo and load_mut as T and return the AccountInfo alongside for save

Source

pub fn get_validated_account(&self, index: usize) -> Option<&'a AccountInfo>

Get a validated account that has already been checked for common requirements

This method allows caching of validated accounts to avoid redundant validations such as signature checks, owner checks, etc.

Source

pub fn set_validated_account(&mut self, index: usize, account: &'a AccountInfo)

Store a validated account in the cache

This method should be called after validating an account’s requirements such as signature checks, owner checks, etc.

Source

pub fn validate_signer( &mut self, index: usize, ) -> Result<&'a AccountInfo, ProgramError>

Validate that an account is a signer and cache it

This method checks if the account is a signer and caches it for future use to avoid redundant signature validations.

Source

pub fn validate_owner( &mut self, index: usize, program_id: &Pubkey, ) -> Result<&'a AccountInfo, ProgramError>

Validate that an account is owned by a specific program and cache it

This method checks if the account is owned by the specified program ID and caches it for future use to avoid redundant owner validations.

Source

pub fn validate_signer_and_owner( &mut self, index: usize, program_id: &Pubkey, ) -> Result<&'a AccountInfo, ProgramError>

Validate that an account is a signer and owned by a specific program, then cache it

This method combines signature and owner validation and caches the result to avoid redundant validations.

Auto Trait Implementations§

§

impl<'a> Freeze for PinoContext<'a>

§

impl<'a> RefUnwindSafe for PinoContext<'a>

§

impl<'a> !Send for PinoContext<'a>

§

impl<'a> !Sync for PinoContext<'a>

§

impl<'a> Unpin for PinoContext<'a>

§

impl<'a> UnsafeUnpin for PinoContext<'a>

§

impl<'a> !UnwindSafe for PinoContext<'a>

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, 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.