#[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.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Env<'a>
impl<'a> !RefUnwindSafe for Env<'a>
impl<'a> !Send for Env<'a>
impl<'a> !Sync for Env<'a>
impl<'a> Unpin for Env<'a>
impl<'a> !UnwindSafe for Env<'a>
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
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>
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>
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