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>
impl<'a> PhasedFrame<'a, Unresolved>
Sourcepub fn new(
program_id: &'a Address,
accounts: &'a [AccountView],
ix_data: &'a [u8],
) -> Result<Self, ProgramError>
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.
Sourcepub fn resolve<T, F>(
self,
min_accounts: usize,
f: F,
) -> Result<ResolvedFrame<'a, T>, ProgramError>
pub fn resolve<T, F>( self, min_accounts: usize, f: F, ) -> Result<ResolvedFrame<'a, 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> 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