Struct revm::EVM[][src]

pub struct EVM<DB> {
    pub env: Env,
    pub db: Option<DB>,
}
Expand description

Struct that takes Database and enabled transact to update state dirrectly to database. additionaly it allows user to set all environment parameters.

Parameters that can be set are devided between Config, Block and Transaction(tx)

For transacting on EVM you can call transact_commit that will automatically apply changes to db.

You can do a lot with rust and traits. For Database abstractions that we need you can implement, Database, DatabaseRef or Database+DatabaseCommit and they enable functionality depending on what kind of handling of struct you want.

  • Database trait has mutable self in its functions. It is usefull if on get calls you want to modify your cache or update some statistics. They enable transact and inspect functions
  • DatabaseRef takes reference on object, this is useful if you only have reference on state and dont want to update anything on it. It enabled transact_ref and inspect_ref functions
  • Database+DatabaseCommit allow’s dirrectly commiting changes of transaction. it enabled transact_commit and inspect_commit

Fields

env: Envdb: Option<DB>

Implementations

Execute transaction and apply result to database

Inspect transaction and commit changes to database.

Execute transaction without writing to DB, return change state.

Execute transaction with given inspector, without wring to DB. Return change state.

Execute transaction without writing to DB, return change state.

Execute transaction with given inspector, without wring to DB. Return change state.

Trait Implementations

Returns the “default value” for a type. Read more

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.

Should always be Self

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.