From 4915bd131ac86afd2c748f73563a261ea6b0026b Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 11 Apr 2023 13:17:04 +0200 Subject: [PATCH] chore: add into_logs (#453) --- crates/primitives/src/result.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/primitives/src/result.rs b/crates/primitives/src/result.rs index 6baa8f25bd..abbcc4f2bf 100644 --- a/crates/primitives/src/result.rs +++ b/crates/primitives/src/result.rs @@ -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 { + match self { + Self::Success { logs, .. } => logs, + _ => Vec::new(), + } + } + pub fn gas_used(&self) -> u64 { let (Self::Success { gas_used, .. } | Self::Revert { gas_used, .. }