pub struct TestContext {
pub svm: Arc<Mutex<LiteSVM>>,
pub rpc: RpcClient,
pub payer: Arc<Keypair>,
}Expand description
Shared test context that bundles a LiteSVM instance, an RPC client backed
by MockRpcSender, and a funded payer keypair.
Fields§
§svm: Arc<Mutex<LiteSVM>>LiteSVM instance behind a synchronous mutex for shared access.
rpc: RpcClientNon-blocking RPC client that dispatches to the same LiteSVM.
payer: Arc<Keypair>Pre-funded payer keypair (1 000 SOL).
Implementations§
Source§impl TestContext
impl TestContext
Sourcepub fn lock_svm(&self) -> MutexGuard<'_, LiteSVM>
pub fn lock_svm(&self) -> MutexGuard<'_, LiteSVM>
Acquire the shared LiteSVM guard, panicking on poison.
A poisoned mutex means a prior test panicked mid-critical-section and the SVM state is no longer trustworthy, so failing fast is the right call for test infrastructure.
Auto Trait Implementations§
impl !RefUnwindSafe for TestContext
impl !UnwindSafe for TestContext
impl Freeze for TestContext
impl Send for TestContext
impl Sync for TestContext
impl Unpin for TestContext
impl UnsafeUnpin for TestContext
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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