diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index ee8786acb..813baa616 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -43,6 +43,7 @@ derive_more = { workspace = true, features = [ "into", "into_iterator", "display", + "deref", ] } paste.workspace = true diff --git a/crates/primitives/src/sealed.rs b/crates/primitives/src/sealed.rs index f69ded2d6..54a1318b6 100644 --- a/crates/primitives/src/sealed.rs +++ b/crates/primitives/src/sealed.rs @@ -1,26 +1,21 @@ +use derive_more::Deref; + use crate::B256; /// A consensus hashable item, with its memoized hash. /// /// We do not implement any specific hashing algorithm here. Instead types /// implement the [`Sealable`] trait to provide define their own hash. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Deref)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Sealed { /// The inner item + #[deref] inner: T, /// Its hash. seal: B256, } -impl core::ops::Deref for Sealed { - type Target = T; - - fn deref(&self) -> &Self::Target { - self.inner() - } -} - impl Sealed { /// Instantiate without performing the hash. This should be used carefully. pub const fn new_unchecked(inner: T, seal: B256) -> Self {