pub struct ExecutionEnv { /* private fields */ }Expand description
Represents the environment accessible in the contract execution context.
ExecutionEnv provides pre- and post-execution methods for the contract, such as performing non-reentrant checks
and handling the attached value.
Implementations§
Source§impl ExecutionEnv
impl ExecutionEnv
Sourcepub fn new(env: Rc<ContractEnv>) -> Self
pub fn new(env: Rc<ContractEnv>) -> Self
Creates a new ExecutionEnv instance.
Sourcepub fn non_reentrant_before(&self)
pub fn non_reentrant_before(&self)
Performs non-reentrant checks before executing a function.
Sourcepub fn non_reentrant_after(&self)
pub fn non_reentrant_after(&self)
Resets the reentrancy guard after executing a function.
Sourcepub fn handle_attached_value(&self)
pub fn handle_attached_value(&self)
Handles the attached value in the execution environment.
Sourcepub fn clear_attached_value(&self)
pub fn clear_attached_value(&self)
Clears the attached value in the execution environment.
Sourcepub fn get_named_arg<T: FromBytes + EntrypointArgument>(&self, name: &str) -> T
pub fn get_named_arg<T: FromBytes + EntrypointArgument>(&self, name: &str) -> T
Retrieves the value of a named argument from the execution environment.
§Returns
The deserialized value of the named argument. If the argument does not exist or deserialization fails, the contract will revert.
Sourcepub fn migrate_schemas(&self, new_schemas: BTreeMap<String, Schema>)
pub fn migrate_schemas(&self, new_schemas: BTreeMap<String, Schema>)
Migrates the schemas in the contract storage to the new schemas.
Trait Implementations§
Source§impl Revertible for ExecutionEnv
impl Revertible for ExecutionEnv
Auto Trait Implementations§
impl Freeze for ExecutionEnv
impl !RefUnwindSafe for ExecutionEnv
impl !Send for ExecutionEnv
impl !Sync for ExecutionEnv
impl Unpin for ExecutionEnv
impl !UnwindSafe for ExecutionEnv
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> 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