From 0bb6f510823f2b10b8647ce328f8d8155c361b1b Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 6 Feb 2023 02:33:25 +0100 Subject: [PATCH] chore: add convenient from impls (#2112) --- ethers-core/src/types/trace/geth.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ethers-core/src/types/trace/geth.rs b/ethers-core/src/types/trace/geth.rs index ededdadb..6c4ca3ac 100644 --- a/ethers-core/src/types/trace/geth.rs +++ b/ethers-core/src/types/trace/geth.rs @@ -70,6 +70,18 @@ pub enum GethTraceFrame { CallTracer(CallFrame), } +impl From for GethTraceFrame { + fn from(value: DefaultFrame) -> Self { + GethTraceFrame::Default(value) + } +} + +impl From for GethTraceFrame { + fn from(value: CallFrame) -> Self { + GethTraceFrame::CallTracer(value) + } +} + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum GethTrace { @@ -77,6 +89,18 @@ pub enum GethTrace { Unknown(Value), } +impl From for GethTrace { + fn from(value: GethTraceFrame) -> Self { + GethTrace::Known(value) + } +} + +impl From for GethTrace { + fn from(value: Value) -> Self { + GethTrace::Unknown(value) + } +} + /// Available built-in tracers /// /// See