7 stable releases
9.0.0 | Jul 28, 2021 |
---|---|
8.0.0 | Jul 28, 2021 |
7.5.0 | Mar 24, 2021 |
7.4.0 | Jun 24, 2020 |
7.1.0 | Dec 4, 2019 |
#3 in #evmc
55KB
1K
SLoC
evmc-declare
This is a Rust interface to EVMC.
This crate contains a declare macro for easily creating EVMC compatible VM implementations.
lib.rs
:
evmc-declare is an attribute-style procedural macro to be used for automatic generation of FFI code for the EVMC API with minimal boilerplate.
evmc-declare can be used by applying its attribute to any struct which implements the EvmcVm
trait, from the evmc-vm crate.
The macro takes three arguments: a valid UTF-8 stylized VM name, a comma-separated list of capabilities, and a version string.
Example
#[evmc_declare::evmc_declare_vm("This is an example VM name", "ewasm, evm", "1.2.3-custom")]
pub struct ExampleVM;
impl evmc_vm::EvmcVm for ExampleVM {
fn init() -> Self {
ExampleVM {}
}
fn execute(&self, revision: evmc_vm::ffi::evmc_revision, code: &[u8], message: &evmc_vm::ExecutionMessage, context: Option<&mut evmc_vm::ExecutionContext>) -> evmc_vm::ExecutionResult {
evmc_vm::ExecutionResult::success(1337, None)
}
}
Dependencies
~1.7–4MB
~77K SLoC