rust-bitcoin-unsafe-fast/hashes/src
Tobin C. Harding 10374af75c
Make error types uniform
On our way to v1.0.0 we are defining a standard for our error types,
this includes:

- Uses the following derives (unless not possible, usually because of `io::Error`)

  `#[derive(Debug, Clone, PartialEq, Eq)]`

- Has `non_exhaustive` unless we really know we can commit to not adding
  anything.

Furthermore, we are trying to make the codebase easy to read. Error code
is write-once-read-many (well it should be) so if we make all the error
code super uniform the users can flick to an error and quickly see what
it includes. In an effort to achieve this I have made up a style and
over recent times have change much of the error code to that new style,
this PR audits _all_ error types in the code base and enforces the
style, specifically:

- Is layed out: definition, [impl block], Display impl, error::Error impl, From impls
- `error::Error` impl matches on enum even if it returns `None` for all variants
- Display/Error impls import enum variants locally
- match uses *self and `ref e`
- error::Error variants that return `Some` come first, `None` after

Re: non_exhaustive

To make dev and review easier I have added `non_exhaustive` to _every_
error type. We can then remove it error by error as we see fit. This is
because it takes a bit of thinking to do and review where as this patch
should not take much brain power to review.
2023-10-04 15:15:52 +11:00
..
cmp.rs hashes: Introduce SPDX license identifiers 2023-05-01 09:26:36 +10:00
hash160.rs Improve hashes::Error 2023-05-25 13:25:13 +10:00
hmac.rs Improve hashes::Error 2023-05-25 13:25:13 +10:00
impls.rs Depend on hex-conservative 2023-07-21 10:59:46 +10:00
internal_macros.rs Depend on hex-conservative 2023-07-21 10:59:46 +10:00
lib.rs Make error types uniform 2023-10-04 15:15:52 +11:00
ripemd160.rs Introduce the `small-hash` feature for `bitcoin_hashes` 2023-08-16 14:19:17 +02:00
serde_macros.rs Remove docsrs attributes 2023-07-14 14:59:11 +10:00
sha1.rs Improve hashes::Error 2023-05-25 13:25:13 +10:00
sha256.rs Merge rust-bitcoin/rust-bitcoin#1990: Introduce the `small-hash` feature for `bitcoin_hashes` 2023-08-17 16:34:10 +00:00
sha256d.rs Improve hashes::Error 2023-05-25 13:25:13 +10:00
sha256t.rs Clear incorrect implementation of clone warning 2023-08-25 12:08:56 +10:00
sha512.rs Introduce the `small-hash` feature for `bitcoin_hashes` 2023-08-16 14:19:17 +02:00
sha512_256.rs Make sha512::HashEngine fields private 2023-06-20 10:11:11 +10:00
siphash24.rs Improve hashes::Error 2023-05-25 13:25:13 +10:00
util.rs Merge rust-bitcoin/rust-bitcoin#1933: Fix links in docs 2023-08-02 16:37:13 +02:00