Merge rust-bitcoin/rust-bitcoin#1011: Add non_exhaustive compiler directive to `AddressType`

43b684bbe6 Add non_exhaustive compiler directive to AddressType (Tobin C. Harding)

Pull request description:

  Add non_exhaustive compiler directive to AddressType

  Currently adding variants to enums is a breaking change. In an effort to
  reduce the upgrade burden on users we can use the `non_exhaustive`
  compiler directive so that adding a new variant does not cause
  downstream code to break.

  Add `non_exhaustive` to the `AddressType` since it may be extended in
  the future.

ACKs for top commit:
  sanket1729:
    ACK 43b684bbe6
  Kixunil:
    ACK 43b684bbe6
  apoelstra:
    ACK 43b684bbe6

Tree-SHA512: 2b2a15fb501d23058acca94318776ffcccedf463d43d07afa290fba46a7bd58b3a730f6e1f25605ef399afcfdb5de4c7ad67eaa0adff0ba39b0096cbcec10f57
This commit is contained in:
Andrew Poelstra 2022-06-02 14:13:38 +00:00
commit adf3958127
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 1 additions and 0 deletions

View File

@ -140,6 +140,7 @@ impl From<bech32::Error> for Error {
/// The different types of addresses. /// The different types of addresses.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[non_exhaustive]
pub enum AddressType { pub enum AddressType {
/// Pay to pubkey hash. /// Pay to pubkey hash.
P2pkh, P2pkh,