Skip to content

Commit

Permalink
Add clone method to ContextWithHandlerCfg (#1127)
Browse files Browse the repository at this point in the history
* Add `clone` to `ContextWithHandlerCfg`

* Fix `clippy` error.

`HandlerCfg` implements `Copy`, i prefer `.clone()` to be more redable but pass test is more important :)
  • Loading branch information
CorrM authored Feb 26, 2024
1 parent 1411784 commit 02ae4e6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/revm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ impl<EXT, DB: Database> ContextWithHandlerCfg<EXT, DB> {
}
}

impl<EXT: Clone, DB: Database + Clone> Clone for ContextWithHandlerCfg<EXT, DB>
where
DB::Error: Clone,
{
fn clone(&self) -> Self {
Self {
context: self.context.clone(),
cfg: self.cfg,
}
}
}

/// EVM contexts contains data that EVM needs for execution.
#[derive(Debug)]
pub struct EvmContext<DB: Database> {
Expand Down

0 comments on commit 02ae4e6

Please sign in to comment.