pub trait EvmFactory<'a>: DbConnect<'a> {
type Ext: Sync;
// Required method
fn create(
&'a self,
) -> Result<EvmNeedsCfg<'a, Self::Ext, Self::Database>, Self::Error>;
// Provided methods
fn create_with_cfg<C>(
&'a self,
cfg: &C,
) -> Result<EvmNeedsBlock<'a, Self::Ext, Self::Database>, Self::Error>
where C: Cfg { ... }
fn create_with_block<C, B>(
&'a self,
cfg: &C,
block: &B,
) -> Result<EvmNeedsTx<'a, Self::Ext, Self::Database>, Self::Error>
where C: Cfg,
B: Block { ... }
fn create_with_tx<C, B, T>(
&'a self,
cfg: &C,
block: &B,
tx: &T,
) -> Result<EvmReady<'a, Self::Ext, Self::Database>, Self::Error>
where C: Cfg,
B: Block,
T: Tx { ... }
fn transact<C, B, T>(
&'a self,
cfg: &C,
block: &B,
tx: &T,
) -> Result<Result<EvmTransacted<'a, Self::Ext, Self::Database>, EvmErrored<'a, Self::Ext, Self::Database>>, Self::Error>
where C: Cfg,
B: Block,
T: Tx { ... }
fn run<C, B, T>(
&'a self,
cfg: &C,
block: &B,
tx: &T,
) -> Result<ResultAndState, EVMError<<Self::Database as Database>::Error>>
where C: Cfg,
B: Block,
T: Tx { ... }
}Expand description
Trait for types that can create EVM instances.
Factories should contain configuration information like chain EXT types,
and database connections. They are intended to enable parallel instantiation
of multiple EVMs in multiple threads sharing some configuration or backing
store.
The lifetime on this trait allows the resulting EVM to borrow from the
connector. E.g. the connector may contain some Db and the resulting EVM
may contain &Db. This allows for (e.g.) shared caches between EVMs on
multiple threads.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn create_with_cfg<C>(
&'a self,
cfg: &C,
) -> Result<EvmNeedsBlock<'a, Self::Ext, Self::Database>, Self::Error>where
C: Cfg,
fn create_with_cfg<C>(
&'a self,
cfg: &C,
) -> Result<EvmNeedsBlock<'a, Self::Ext, Self::Database>, Self::Error>where
C: Cfg,
Create a new EVM instance and parameterize it with a Cfg.
Sourcefn create_with_block<C, B>(
&'a self,
cfg: &C,
block: &B,
) -> Result<EvmNeedsTx<'a, Self::Ext, Self::Database>, Self::Error>
fn create_with_block<C, B>( &'a self, cfg: &C, block: &B, ) -> Result<EvmNeedsTx<'a, Self::Ext, Self::Database>, Self::Error>
Sourcefn create_with_tx<C, B, T>(
&'a self,
cfg: &C,
block: &B,
tx: &T,
) -> Result<EvmReady<'a, Self::Ext, Self::Database>, Self::Error>
fn create_with_tx<C, B, T>( &'a self, cfg: &C, block: &B, tx: &T, ) -> Result<EvmReady<'a, Self::Ext, Self::Database>, Self::Error>
Sourcefn transact<C, B, T>(
&'a self,
cfg: &C,
block: &B,
tx: &T,
) -> Result<Result<EvmTransacted<'a, Self::Ext, Self::Database>, EvmErrored<'a, Self::Ext, Self::Database>>, Self::Error>
fn transact<C, B, T>( &'a self, cfg: &C, block: &B, tx: &T, ) -> Result<Result<EvmTransacted<'a, Self::Ext, Self::Database>, EvmErrored<'a, Self::Ext, Self::Database>>, Self::Error>
Create a new EVM instance, parameterize it with a Cfg, a
Block, and a Tx, and run the transaction, yielding either
EvmTransacted or EvmErrored.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.