Skip to content

Commit db7a238

Browse files
committed
Merge rust-bitcoin#4658: backport to v0.32: Remove non_exhaustive from Network
3cf4a91 Remove non_exhausive from Network (Tobin C. Harding) Pull request description: This is rust-bitcoin#4640 backported manually. Remove `non_exhaustive` from `Network` enum. ACKs for top commit: apoelstra: ACK 3cf4a91; successfully ran local tests Tree-SHA512: 690cdcf82a9e87f2100aa8e996583bd54f969d8d55eba062ace66bdf2ae9ae1c482d6220bb26690ebfaf3a35ca3f5ce0ecaac3a79b4061c75e9fb7adbe032f48
2 parents d31d17e + 3cf4a91 commit db7a238

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

bitcoin/src/network.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,19 @@ impl From<Network> for NetworkKind {
5959
}
6060

6161
/// The cryptocurrency network to act on.
62+
///
63+
/// This is an exhaustive enum, meaning that we cannot add any future networks without defining a
64+
/// new, incompatible version of this type. If you are using this type directly and wish to support the
65+
/// new network, this will be a breaking change to your APIs and likely require changes in your code.
66+
///
67+
/// If you are concerned about forward compatibility, consider using `T: Into<Params>` instead of
68+
/// this type as a parameter to functions in your public API, or directly using the `Params` type.
69+
// For extensive discussion on the usage of `non_exhaustive` please see:
70+
// https://github.com/rust-bitcoin/rust-bitcoin/issues/2225
6271
#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug)]
6372
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6473
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
6574
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
66-
#[non_exhaustive]
6775
pub enum Network {
6876
/// Mainnet Bitcoin.
6977
Bitcoin,

0 commit comments

Comments
 (0)