pub struct Program { /* private fields */ }Expand description
A lightweight Program wrapper for building instructions in tests.
Simplified API for testing without RPC layer abstractions:
ⓘ
let ix = ctx.program()
.accounts(my_program::accounts::Transfer { ... })
.args(my_program::instruction::Transfer { ... })
.instruction()?;Implementations§
Source§impl Program
impl Program
Sourcepub fn accounts<T: ToAccountMetas>(self, accounts: T) -> InstructionBuilder
pub fn accounts<T: ToAccountMetas>(self, accounts: T) -> InstructionBuilder
Start building an instruction with accounts.
This returns an InstructionBuilder that you can chain with .args() and .instruction().
§Example
ⓘ
let ix = ctx.program()
.accounts(my_program::accounts::Initialize {
user: user.pubkey(),
account: data_account,
system_program: system_program::id(),
})
.args(my_program::instruction::Initialize { value: 42 })
.instruction()?;Trait Implementations§
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnsafeUnpin for Program
impl UnwindSafe for Program
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more