From 7685461e62beab0bcec8a96b732e58345b2640d9 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 24 Apr 2024 09:14:02 +1000 Subject: [PATCH] Document the sha256t_hash_newtype direction Since the default display direction is now forward, use `#[hash_newtype(backward)]` in the rustdocs on the macro. Also add an example usage to the changelog in case someone downstream is relying on the old default behaviour of displaying backwards (unlikely). --- hashes/CHANGELOG.md | 17 +++++++++++++++++ hashes/src/sha256t.rs | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/hashes/CHANGELOG.md b/hashes/CHANGELOG.md index ca96b020a..887776a59 100644 --- a/hashes/CHANGELOG.md +++ b/hashes/CHANGELOG.md @@ -1,3 +1,20 @@ +# unreleased + +* Change the default display direction of for tagged hashes to forwards. [#2707](https://github.com/rust-bitcoin/rust-bitcoin/pull/2707) + + Note please this usage if you need to display backward: + +```rust + sha256t_hash_newtype! { + /// Test detailed explanation. + struct NewTypeTag = hash_str("tag"); + + /// A test hash. + #[hash_newtype(backward)] + struct NewTypeHash(_); + } +``` + # 0.14.0 - 2024-03-21 * Bump MSRV to Rust version 1.56.1 [#2188](https://github.com/rust-bitcoin/rust-bitcoin/pull/2188) diff --git a/hashes/src/sha256t.rs b/hashes/src/sha256t.rs index 6627048cc..13b19c645 100644 --- a/hashes/src/sha256t.rs +++ b/hashes/src/sha256t.rs @@ -91,8 +91,8 @@ fn from_engine(e: sha256::HashEngine) -> Hash { /// pub struct FooTag = hash_str("foo"); /// /// /// A foo hash. -/// // Direction works just like in case of hash_newtype! macro. -/// #[hash_newtype(forward)] +/// // Direction works just like the hash_newtype! macro. +/// #[hash_newtype(backward)] /// pub struct FooHash(_); /// } /// ```