Skip to content

Commit

Permalink
feat: take result and state
Browse files Browse the repository at this point in the history
  • Loading branch information
prestwich committed Nov 21, 2024
1 parent 62d9449 commit dd662fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trevm"
version = "0.14.2"
version = "0.14.3"
rust-version = "1.82.0"
edition = "2021"
authors = ["init4"]
Expand Down
12 changes: 12 additions & 0 deletions src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,18 @@ impl<'a, Ext, Db: Database + DatabaseCommit> EvmTransacted<'a, Ext, Db> {
}

/// Take the [`ResultAndState`] and return the EVM.
pub fn into_result_and_state(self) -> ResultAndState {
self.state.result
}

/// Take the [`ResultAndState`] and return the EVM.
pub fn take_result_and_state(self) -> (ResultAndState, EvmNeedsTx<'a, Ext, Db>) {
let Trevm { inner, state: TransactedState { result } } = self;
(result, Trevm { inner, state: NeedsTx::new() })
}

/// Take the [`ExecutionResult`], discard the [`EvmState`] and return the
/// EVM.
pub fn take_result(self) -> (ExecutionResult, EvmNeedsTx<'a, Ext, Db>) {
let Trevm { inner, state: TransactedState { result } } = self;
(result.result, Trevm { inner, state: NeedsTx::new() })
Expand Down

0 comments on commit dd662fd

Please sign in to comment.