From 8f23ff43ad8ee7a686d5c537d081e76387ecc956 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 16 Mar 2023 15:21:52 +0100 Subject: [PATCH] feat: add Output::into_data --- crates/primitives/src/result.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/primitives/src/result.rs b/crates/primitives/src/result.rs index a265dd5bbd..6baa8f25bd 100644 --- a/crates/primitives/src/result.rs +++ b/crates/primitives/src/result.rs @@ -71,6 +71,16 @@ pub enum Output { ), } +impl Output { + /// Returns the output data of the execution output. + pub fn into_data(self) -> Bytes { + match self { + Output::Call(data) => data, + Output::Create(data, _) => data, + } + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum EVMError {