Skip to content

Commit df37667

Browse files
committed
Make configuration non_exhaustive to allow future upgrade without breaking downsteam
1 parent 96fa072 commit df37667

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/lib.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub struct ConnectParams {
5555
}
5656

5757
/// Enum to specify p2p settings
58+
#[derive(Debug, PartialEq, Eq)]
5859
pub enum P2P {
5960
/// the node doesn't open a p2p port and work in standalone mode
6061
No,
@@ -79,19 +80,24 @@ const LOCAL_IP: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1);
7980

8081
/// The node configuration parameters, implements a convenient [Default] for most common use.
8182
///
83+
/// `#[non_exhaustive]` allows adding new parameters without breaking downstream users
84+
///
8285
/// Default values:
83-
/// ```no_run
84-
/// bitcoind::Conf {
85-
/// args: vec!["-regtest", "-fallbackfee=0.0001"],
86-
/// view_stdout: false,
87-
/// p2p: bitcoind::P2P::No,
88-
/// network: "regtest",
89-
/// };
9086
/// ```
87+
/// let mut conf = bitcoind::Conf::default();
88+
/// conf.args = vec!["-regtest", "-fallbackfee=0.0001"];
89+
/// conf.view_stdout = false;
90+
/// conf.p2p = bitcoind::P2P::No;
91+
/// conf.network = "regtest";
92+
/// assert_eq!(conf, bitcoind::Conf::default());
93+
/// ```
94+
///
95+
#[non_exhaustive]
96+
#[derive(Debug, PartialEq, Eq)]
9197
pub struct Conf<'a> {
9298
/// Bitcoind command line arguments containing no spaces like `vec!["-dbcache=300", "-regtest"]`
93-
/// note that `port`, `rpcport`, `connect`, `datadir`, `listen` cannot be used cause they are
94-
/// automatically initialized.
99+
/// note that `port`, `rpcport`, `connect`, `datadir`, `listen`
100+
/// cannot be used because they are automatically initialized.
95101
pub args: Vec<&'a str>,
96102

97103
/// if `true` bitcoind log output will not be suppressed

0 commit comments

Comments
 (0)