pub struct PostMutationValidator<const N: usize> { /* private fields */ }Expand description
Collects post-mutation checks that run after instruction execution.
Use this to verify invariants that can’t be checked upfront: balance conservation, escrow solvency, authority immutability, etc.
ⓘ
let mut post = PostMutationValidator::<4>::new();
post.add(check_vault_solvent)?;
post.add(check_balance_conserved)?;
// ... execute mutations ...
post.run(accounts, program_id)?;Implementations§
Source§impl<const N: usize> PostMutationValidator<N>
impl<const N: usize> PostMutationValidator<N>
Sourcepub fn add(&mut self, check: PostMutationFn) -> Result<(), ProgramError>
pub fn add(&mut self, check: PostMutationFn) -> Result<(), ProgramError>
Add a post-mutation check.
Sourcepub fn run(
&self,
accounts: &[AccountView],
program_id: &Address,
) -> ProgramResult
pub fn run( &self, accounts: &[AccountView], program_id: &Address, ) -> ProgramResult
Run all post-mutation checks. Fail-fast.
Trait Implementations§
Auto Trait Implementations§
impl<const N: usize> Freeze for PostMutationValidator<N>
impl<const N: usize> RefUnwindSafe for PostMutationValidator<N>
impl<const N: usize> Send for PostMutationValidator<N>
impl<const N: usize> Sync for PostMutationValidator<N>
impl<const N: usize> Unpin for PostMutationValidator<N>
impl<const N: usize> UnsafeUnpin for PostMutationValidator<N>
impl<const N: usize> UnwindSafe for PostMutationValidator<N>
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