Struct evmc_sys::evmc_result[][src]

#[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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.