Skip to content

Commit

Permalink
Merge rust-bitcoin/bitcoin_hashes#153: Add docs to the code create by…
Browse files Browse the repository at this point in the history
… sha256t_hash_newtype macro

6802b99 Add docs to the code create by sha256t_hash_newtype macro (Tobin C. Harding)

Pull request description:

  When using the `sha256t_hash_newtype` currently no docs are generated,
  this causes lint errors for users who lint for such things.

  Add docs to the new type created by the `sha256t_hash_newtype` macro.

  (This is identical to how we do it in the duplicate macro of the same
  name in `rust-bitcoin`, which can be removed in favour of this one after
  this patch is applied.)

ACKs for top commit:
  apoelstra:
    ACK 6802b99

Tree-SHA512: cfeab98a3c8185b87a0144b36c42b89fd01766dd0e21d8e66652637b9ce3e466009051b538f61d4d033b2a54c0cb6e66607eecbde745dae737003cbf91d86a94
  • Loading branch information
arremoEngervetl authored and apoelstra committed Apr 30, 2022
2 parents 4b30c83 + 6802b99 commit ccfa864
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sha256t.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ impl<T: Tag> HashTrait for Hash<T> {
#[macro_export]
macro_rules! sha256t_hash_newtype {
($newtype:ident, $tag:ident, $midstate:ident, $midstate_len:expr, $docs:meta, $reverse: expr) => {
/// The tag used for [$newtype].
sha256t_hash_newtype!($newtype, $tag, $midstate, $midstate_len, $docs, $reverse, stringify!($newtype));
};

($newtype:ident, $tag:ident, $midstate:ident, $midstate_len:expr, $docs:meta, $reverse: expr, $sname:expr) => {
#[doc = "The tag used for ["]
#[doc = $sname]
#[doc = "]"]
#[derive(Copy, Clone, PartialEq, Eq, Default, PartialOrd, Ord, Hash)]
pub struct $tag;

impl $crate::sha256t::Tag for $tag {
Expand Down

0 comments on commit ccfa864

Please sign in to comment.