evmc_result

Struct evmc_result 

Source
#[repr(C)]
pub struct evmc_result { pub status_code: evmc_status_code, pub gas_left: i64, pub output_data: *const u8, pub output_size: usize, pub release: evmc_release_result_fn, pub create_address: evmc_address, pub padding: [u8; 4], }
Expand description

The EVM code execution result.

Fields§

§status_code: evmc_status_code

The execution status code.

§gas_left: i64

The amount of gas left after the execution.

If evmc_result::status_code is neither ::EVMC_SUCCESS nor ::EVMC_REVERT the value MUST be 0.

§output_data: *const u8

The reference to output data.

The output contains data coming from RETURN opcode (iff evmc_result::code field is ::EVMC_SUCCESS) or from REVERT opcode.

The memory containing the output data is owned by EVM and has to be freed with evmc_result::release().

This MAY be NULL.

§output_size: usize

The size of the output data.

If output_data is NULL this MUST be 0.

§release: evmc_release_result_fn

The method releasing all resources associated with the result object.

This method (function pointer) is optional (MAY be NULL) and MAY be set by the VM implementation. If set it MUST be called by the user once to release memory and other resources associated with the result object. Once the resources are released the result object MUST NOT be used again.

The suggested code pattern for releasing execution results: @code struct evmc_result result = …; if (result.release) result.release(&result); @endcode

@note It works similarly to C++ virtual destructor. Attaching the release function to the result itself allows VM composition.

§create_address: evmc_address

The address of the contract created by create instructions.

This field has valid value only if:

  • it is a result of the Host method evmc_host_interface::call
  • and the result describes successful contract creation (evmc_result::status_code is ::EVMC_SUCCESS). In all other cases the address MUST be null bytes.
§padding: [u8; 4]

Reserved data that MAY be used by a evmc_result object creator.

This reserved 4 bytes together with 20 bytes from create_address form 24 bytes of memory called “optional data” within evmc_result struct to be optionally used by the evmc_result object creator.

@see evmc_result_optional_data, evmc_get_optional_data().

Also extends the size of the evmc_result to 64 bytes (full cache line).

Trait Implementations§

Source§

impl Clone for evmc_result

Source§

fn clone(&self) -> evmc_result

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for evmc_result

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for evmc_result

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for evmc_result

Source§

fn eq(&self, other: &evmc_result) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for evmc_result

Source§

impl StructuralPartialEq for evmc_result

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.