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).
This commit is contained in:
Tobin C. Harding 2024-04-24 09:14:02 +10:00
parent 30e91cc766
commit 7685461e62
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
2 changed files with 19 additions and 2 deletions

View File

@ -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)

View File

@ -91,8 +91,8 @@ fn from_engine<T: Tag>(e: sha256::HashEngine) -> Hash<T> {
/// 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(_);
/// }
/// ```