#[repr(C)]pub struct Env<'a> { /* private fields */ }
Expand description
Ephemeral execution environment.
In guest environment equivalent to just EnvState
, while on Unix and Windows an executor
context is also present
Implementations§
Source§impl<'a> Env<'a>
impl<'a> Env<'a>
Sourcepub fn with_executor_context(
state: EnvState,
executor_context: &'a mut dyn ExecutorContext,
) -> Self
pub fn with_executor_context( state: EnvState, executor_context: &'a mut dyn ExecutorContext, ) -> Self
Instantiate environment with executor context
Sourcepub fn get_mut_executor_context(&mut self) -> &mut dyn ExecutorContext
pub fn get_mut_executor_context(&mut self) -> &mut dyn ExecutorContext
Instantiate environment with executor context
Sourcepub fn shard_index(&self) -> ShardIndex
pub fn shard_index(&self) -> ShardIndex
Shard index where execution is happening
Sourcepub fn own_address(&self) -> Address
pub fn own_address(&self) -> Address
Own address of the contract
Sourcepub fn call<Args>(
&self,
contract: Address,
args: &mut Args,
method_context: MethodContext,
) -> Result<(), ContractError>where
Args: ExternalArgs,
pub fn call<Args>(
&self,
contract: Address,
args: &mut Args,
method_context: MethodContext,
) -> Result<(), ContractError>where
Args: ExternalArgs,
Call a method at specified address and with specified arguments.
This is a shortcut for Self::prepare_method_call()
+ Self::call_prepared()
.
Sourcepub fn prepare_method_call<Args>(
contract: Address,
args: &mut Args,
method_context: MethodContext,
) -> PreparedMethod<'_>where
Args: ExternalArgs,
pub fn prepare_method_call<Args>(
contract: Address,
args: &mut Args,
method_context: MethodContext,
) -> PreparedMethod<'_>where
Args: ExternalArgs,
Prepare a single method for calling at specified address and with specified arguments.
The result is to be used with Self::call_prepared()
afterward.
Sourcepub fn call_prepared(
&self,
method: PreparedMethod<'_>,
) -> Result<(), ContractError>
pub fn call_prepared( &self, method: PreparedMethod<'_>, ) -> Result<(), ContractError>
Call prepared method.
In most cases, this doesn’t need to be called directly. Extension traits provide a more convenient way to make method calls and are enough in most cases.