rust-bitcoin-unsafe-fast/bitcoin/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
..
address Make error types uniform 2023-10-04 15:15:52 +11:00
blockdata Make error types uniform 2023-10-04 15:15:52 +11:00
consensus Make error types uniform 2023-10-04 15:15:52 +11:00
crypto Make error types uniform 2023-10-04 15:15:52 +11:00
merkle_tree Make error types uniform 2023-10-04 15:15:52 +11:00
p2p Make error types uniform 2023-10-04 15:15:52 +11:00
psbt Make error types uniform 2023-10-04 15:15:52 +11:00
amount.rs Make error types uniform 2023-10-04 15:15:52 +11:00
base58.rs Make error types uniform 2023-10-04 15:15:52 +11:00
bip32.rs Make error types uniform 2023-10-04 15:15:52 +11:00
bip152.rs Make error types uniform 2023-10-04 15:15:52 +11:00
bip158.rs Make error types uniform 2023-10-04 15:15:52 +11:00
error.rs Remove impl_std_error macro 2023-10-04 15:15:34 +11:00
hash_types.rs Move XpubIdentifier to the bip32 module 2023-09-04 02:13:55 +10:00
internal_macros.rs Depend on hex-conservative 2023-07-21 10:59:46 +10:00
lib.rs Merge rust-bitcoin/rust-bitcoin#2021: Move and rename `XpubIdentifier` 2023-09-21 17:55:31 +00:00
network.rs Make error types uniform 2023-10-04 15:15:52 +11:00
parse.rs Make error types uniform 2023-10-04 15:15:52 +11:00
policy.rs bitcoin: Remove attribution from all files 2023-05-01 09:22:48 +10:00
pow.rs Make error types uniform 2023-10-04 15:15:52 +11:00
serde_utils.rs Depend on hex-conservative 2023-07-21 10:59:46 +10:00
sign_message.rs Make error types uniform 2023-10-04 15:15:52 +11:00
string.rs Make error types uniform 2023-10-04 15:15:52 +11:00
taproot.rs Make error types uniform 2023-10-04 15:15:52 +11:00
test_macros.rs bitcoin: Remove attribution from all files 2023-05-01 09:22:48 +10:00