From 98691186dcb816c46b86c3f8d6b97f8d31a45a17 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 16 Oct 2024 12:19:12 +1100 Subject: [PATCH] hashes: Move engine functions The `sha256t` module is unique in that it implements its methods manually (as call throughs) instead of using the macros. To make it more clear what is implemented re-order the engine constructor and getter to better mirror the layout in the macros. Internal change only. --- hashes/src/sha256t.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hashes/src/sha256t.rs b/hashes/src/sha256t.rs index 20faa9e06..3619efe92 100644 --- a/hashes/src/sha256t.rs +++ b/hashes/src/sha256t.rs @@ -42,12 +42,6 @@ where unsafe { &mut *(bytes as *mut _ as *mut Self) } } - /// Constructs a new engine. - pub fn engine() -> HashEngine { T::engine() } - - /// Produces a hash from the current state of a given engine. - pub fn from_engine(e: HashEngine) -> Hash { from_engine(e) } - /// Copies a byte slice into a hash object. #[deprecated(since = "TBD", note = "Use `from_byte_array` instead.")] pub fn from_slice(sl: &[u8]) -> Result, FromSliceError> { @@ -60,6 +54,12 @@ where } } + /// Produces a hash from the current state of a given engine. + pub fn from_engine(e: HashEngine) -> Hash { from_engine(e) } + + /// Constructs a new engine. + pub fn engine() -> HashEngine { T::engine() } + /// Hashes some bytes. #[allow(clippy::self_named_constructors)] // Hash is a noun and a verb. pub fn hash(data: &[u8]) -> Self {