Skip to content

Commit

Permalink
chore: add into_logs (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Apr 11, 2023
1 parent b2c5262 commit 4915bd1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/primitives/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ impl ExecutionResult {
}
}

/// Consumes the type and returns logs, if execution is not successful, function will return empty vec.
pub fn into_logs(self) -> Vec<Log> {
match self {
Self::Success { logs, .. } => logs,
_ => Vec::new(),
}
}

pub fn gas_used(&self) -> u64 {
let (Self::Success { gas_used, .. }
| Self::Revert { gas_used, .. }
Expand Down

0 comments on commit 4915bd1

Please sign in to comment.