pub struct TxContextRef(/* private fields */);
Expand description
The VM API implementation based on a blockchain mock written in Rust. Implemented as a smart pointer to a TxContext structure, which tracks a blockchain transaction.
Implementations§
Source§impl TxContextRef
impl TxContextRef
pub fn new(tx_context_arc: Arc<TxContext>) -> Self
pub fn new_from_static() -> Self
pub fn dummy() -> Self
pub fn into_blockchain_updates(self) -> BlockchainUpdate
Sourcepub fn into_tx_result(self) -> TxResult
pub fn into_tx_result(self) -> TxResult
Consumes the current API and returns the contained output. Should be called at the end of a tx execution. Will fail if any other references to the tx context survive, this must be the last.
Sourcepub fn replace_tx_result_with_error(self, tx_panic: TxPanic)
pub fn replace_tx_result_with_error(self, tx_panic: TxPanic)
The current method for signalling that the current execution is failed, and with what error.
Note: does not terminate execution or panic, that is handled separately.
Methods from Deref<Target = TxContext>§
pub fn input_ref(&self) -> &TxInput
pub fn blockchain_cache(&self) -> &TxCache
pub fn blockchain_cache_arc(&self) -> Arc<TxCache>
pub fn blockchain_ref(&self) -> &BlockchainState
pub fn with_account<R, F>(&self, address: &VMAddress, f: F) -> Rwhere
F: FnOnce(&AccountData) -> R,
pub fn with_account_or_else<R, F, Else>( &self, address: &VMAddress, f: F, or_else: Else, ) -> R
pub fn with_contract_account<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&AccountData) -> R,
pub fn with_account_mut<R, F>(&self, address: &VMAddress, f: F) -> Rwhere
F: FnOnce(&mut AccountData) -> R,
pub fn with_contract_account_mut<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&mut AccountData) -> R,
pub fn m_types_lock(&self) -> MutexGuard<'_, TxManagedTypes>
pub fn back_transfers_lock(&self) -> MutexGuard<'_, BackTransfers>
pub fn result_lock(&self) -> MutexGuard<'_, TxResult>
pub fn extract_result(&self) -> TxResult
pub fn rng_lock(&self) -> MutexGuard<'_, BlockchainRng>
pub fn create_new_contract( &self, new_address: &VMAddress, contract_path: Vec<u8>, code_metadata: VMCodeMetadata, contract_owner: VMAddress, )
Trait Implementations§
Source§impl Clone for TxContextRef
impl Clone for TxContextRef
Source§impl Debug for TxContextRef
impl Debug for TxContextRef
Auto Trait Implementations§
impl Freeze for TxContextRef
impl !RefUnwindSafe for TxContextRef
impl Send for TxContextRef
impl Sync for TxContextRef
impl Unpin for TxContextRef
impl !UnwindSafe for TxContextRef
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