Skip to main content

PhasedFrame

Struct PhasedFrame 

Source
pub struct PhasedFrame<'a, P> { /* private fields */ }
Expand description

A phased execution context that enforces ordering via type state.

P is the current phase – a zero-sized marker type. The frame itself carries no per-phase overhead at runtime; phase transitions are compile-time checked.

Implementations§

Source§

impl<'a> PhasedFrame<'a, Unresolved>

Source

pub fn new( program_id: &'a Address, accounts: &'a [AccountView], ix_data: &'a [u8], ) -> Result<Self, ProgramError>

Create a new phased frame in the Unresolved state.

Source

pub fn resolve<T, F>( self, min_accounts: usize, f: F, ) -> Result<ResolvedFrame<'a, T>, ProgramError>
where F: FnOnce(&'a [AccountView], &'a Address) -> Result<T, ProgramError>,

Resolve accounts – validate account count and transition to Resolved.

The closure receives the accounts slice and program_id, allowing the caller to parse/index accounts into a typed struct.

let resolved = frame.resolve(|accounts, program_id| {
    Ok(MyAccounts {
        payer: &accounts[0],
        vault: &accounts[1],
    })
})?;

Auto Trait Implementations§

§

impl<'a, P> Freeze for PhasedFrame<'a, P>

§

impl<'a, P> RefUnwindSafe for PhasedFrame<'a, P>
where P: RefUnwindSafe,

§

impl<'a, P> Send for PhasedFrame<'a, P>
where P: Send,

§

impl<'a, P> Sync for PhasedFrame<'a, P>
where P: Sync,

§

impl<'a, P> Unpin for PhasedFrame<'a, P>
where P: Unpin,

§

impl<'a, P> UnsafeUnpin for PhasedFrame<'a, P>

§

impl<'a, P> UnwindSafe for PhasedFrame<'a, P>
where P: 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, 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.