chore: add convenient from impls (#2112)

This commit is contained in:
Matthias Seitz 2023-02-06 02:33:25 +01:00 committed by GitHub
parent 56cc3e674a
commit 0bb6f51082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions

View File

@ -70,6 +70,18 @@ pub enum GethTraceFrame {
CallTracer(CallFrame),
}
impl From<DefaultFrame> for GethTraceFrame {
fn from(value: DefaultFrame) -> Self {
GethTraceFrame::Default(value)
}
}
impl From<CallFrame> 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<GethTraceFrame> for GethTrace {
fn from(value: GethTraceFrame) -> Self {
GethTrace::Known(value)
}
}
impl From<Value> for GethTrace {
fn from(value: Value) -> Self {
GethTrace::Unknown(value)
}
}
/// Available built-in tracers
///
/// See <https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers>