Skip to main content

RemainingTyped

Struct RemainingTyped 

Source
pub struct RemainingTyped<'a> { /* private fields */ }
Expand description

Sequential typed parser for remaining accounts.

Implementations§

Source§

impl<'a> RemainingTyped<'a>

Source

pub const fn consumed(&self) -> usize

Number of slots already consumed by typed parsing.

Source

pub fn remaining_len(&self) -> usize

Number of unconsumed remaining slots.

Source

pub fn is_empty(&self) -> bool

True when all remaining slots have been consumed.

Source

pub fn next_account(&mut self) -> Result<&'a AccountView<'a>, ProgramError>

Consume and return the next raw account view.

Source

pub fn next_unchecked(&mut self) -> Result<UncheckedAccount<'a>, ProgramError>

Consume and return the next raw account view as an explicit unchecked role.

Source

pub fn next_signer(&mut self) -> Result<Signer<'a>, ProgramError>

Consume and validate the next account as a signer.

Source

pub fn next_external<T: ExternalZeroCopy>( &mut self, ) -> Result<ExternalAccount<'a, T>, ProgramError>

Consume and validate the next account as a known external layout.

Source

pub fn no_duplicates(self) -> Result<Self, ProgramError>

Fluent duplicate-policy gate for typed remaining parsing.

Source

pub fn take_group( &mut self, len: usize, ) -> Result<RemainingGroup<'a>, ProgramError>

Consume a fixed-size sequential group from the remaining tail.

Call Self::no_duplicates first when the whole tail must be globally alias-free across several groups.

Source

pub fn assert_no_duplicates(&self) -> ProgramResult

Verify every remaining slot is distinct from declared and sibling slots.

Source

pub fn assert_sorted_by<K, F>(&self, key: F) -> ProgramResult
where K: Ord, F: FnMut(&'a AccountView<'a>) -> Result<K, ProgramError>,

Verify all remaining accounts are sorted by a caller-supplied key.

Source

pub fn assert_empty(&self) -> ProgramResult

Require the typed parser to have consumed the full tail.

Auto Trait Implementations§

§

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

§

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

§

impl<'a> Freeze for RemainingTyped<'a>

§

impl<'a> RefUnwindSafe for RemainingTyped<'a>

§

impl<'a> Unpin for RemainingTyped<'a>

§

impl<'a> UnsafeUnpin for RemainingTyped<'a>

§

impl<'a> UnwindSafe for RemainingTyped<'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 = !

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

fn try_from(value: U) -> Result<T, !>

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.