Skip to content

Commit

Permalink
chore: move SealedHeader::cloned to &H (#13904)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 21, 2025
1 parent b0b1d9d commit b63dc2a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/primitives-traits/src/header/sealed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ impl<H: Sealable> SealedHeader<H> {
let hash = self.hash();
(self.header, hash)
}
}

/// Clones the header and returns a new sealed header.
pub fn cloned(self) -> Self
impl<H: Sealable> SealedHeader<&H> {
/// Maps a `SealedHeader<&H>` to a `SealedHeader<H>` by cloning the header.
pub fn cloned(self) -> SealedHeader<H>
where
H: Clone,
{
let (header, hash) = self.split();
Self::new(header, hash)
let Self { hash, header } = self;
SealedHeader { hash, header: header.clone() }
}
}

Expand Down

0 comments on commit b63dc2a

Please sign in to comment.