From a544d4076c0769d171048c73f9f5ddc2e338c576 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 2 Feb 2023 20:12:52 +0100 Subject: [PATCH] feat: add DerefMut for OtherFields (#2109) --- ethers-core/src/types/other.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ethers-core/src/types/other.rs b/ethers-core/src/types/other.rs index abb570d3..72874235 100644 --- a/ethers-core/src/types/other.rs +++ b/ethers-core/src/types/other.rs @@ -1,7 +1,10 @@ //! Support for capturing other fields use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Map; -use std::{collections::BTreeMap, ops::Deref}; +use std::{ + collections::BTreeMap, + ops::{Deref, DerefMut}, +}; /// A type that is supposed to capture additional fields that are not native to ethereum but included in ethereum adjacent networks, for example fields the [optimism `eth_getTransactionByHash` request](https://docs.alchemy.com/alchemy/apis/optimism/eth-gettransactionbyhash) returns additional fields that this type will capture /// @@ -138,6 +141,12 @@ impl Deref for OtherFields { } } +impl DerefMut for OtherFields { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.inner + } +} + impl AsRef> for OtherFields { fn as_ref(&self) -> &BTreeMap { &self.inner