Skip to content

Commit 39b1681

Browse files
committed
Merge #305: Add full stops to rustdocs in node
b4d2681 Add full stops to rustdocs in node (Jamil Lambert, PhD) Pull request description: Use AI to go through every file in node and add missing full stops to the rust docs. Together with #302, #303 and #304 Closes #296 ACKs for top commit: tcharding: ACK b4d2681 Tree-SHA512: 7153ac583469b1481ebcab64e70e2c86a9669fc450059c90e399aca6f55471c8d1cccef9970774b9713d634a9179d0363fe155938d5e9270416a46d7dcd6df36
2 parents aa6710d + b4d2681 commit 39b1681

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

node/src/lib.rs

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@ pub use self::{
3131
};
3232

3333
#[derive(Debug)]
34-
/// Struct representing the bitcoind process with related information
34+
/// Struct representing the bitcoind process with related information.
3535
pub struct Node {
36-
/// Process child handle, used to terminate the process when this struct is dropped
36+
/// Process child handle, used to terminate the process when this struct is dropped.
3737
process: Child,
38-
/// Rpc client linked to this bitcoind process
38+
/// Rpc client linked to this bitcoind process.
3939
pub client: Client,
4040
/// Work directory, where the node store blocks and other stuff.
4141
work_dir: DataDir,
4242

43-
/// Contains information to connect to this node
43+
/// Contains information to connect to this node.
4444
pub params: ConnectParams,
4545
}
4646

4747
#[derive(Debug)]
4848
/// The DataDir struct defining the kind of data directory the node
4949
/// will contain. Data directory can be either persistent, or temporary.
5050
pub enum DataDir {
51-
/// Persistent Data Directory
51+
/// Persistent Data Directory.
5252
Persistent(PathBuf),
53-
/// Temporary Data Directory
53+
/// Temporary Data Directory.
5454
Temporary(TempDir),
5555
}
5656

5757
impl DataDir {
58-
/// Return the data directory path
58+
/// Return the data directory path.
5959
fn path(&self) -> PathBuf {
6060
match self {
6161
Self::Persistent(path) => path.to_owned(),
@@ -65,17 +65,17 @@ impl DataDir {
6565
}
6666

6767
#[derive(Debug, Clone)]
68-
/// Contains all the information to connect to this node
68+
/// Contains all the information to connect to this node.
6969
pub struct ConnectParams {
70-
/// Path to the node cookie file, useful for other client to connect to the node
70+
/// Path to the node cookie file, useful for other client to connect to the node.
7171
pub cookie_file: PathBuf,
72-
/// Url of the rpc of the node, useful for other client to connect to the node
72+
/// Url of the rpc of the node, useful for other client to connect to the node.
7373
pub rpc_socket: SocketAddrV4,
74-
/// p2p connection url, is some if the node started with p2p enabled
74+
/// p2p connection url, is some if the node started with p2p enabled.
7575
pub p2p_socket: Option<SocketAddrV4>,
76-
/// zmq pub raw block connection url
76+
/// zmq pub raw block connection url.
7777
pub zmq_pub_raw_block_socket: Option<SocketAddrV4>,
78-
/// zmq pub raw tx connection Url
78+
/// zmq pub raw tx connection Url.
7979
pub zmq_pub_raw_tx_socket: Option<SocketAddrV4>,
8080
}
8181

@@ -85,55 +85,55 @@ pub struct CookieValues {
8585
}
8686

8787
impl ConnectParams {
88-
/// Parses the cookie file content
88+
/// Parses the cookie file content.
8989
fn parse_cookie(content: String) -> Option<CookieValues> {
9090
let values: Vec<_> = content.splitn(2, ':').collect();
9191
let user = values.first()?.to_string();
9292
let password = values.get(1)?.to_string();
9393
Some(CookieValues { user, password })
9494
}
9595

96-
/// Return the user and password values from cookie file
96+
/// Return the user and password values from cookie file.
9797
pub fn get_cookie_values(&self) -> Result<Option<CookieValues>, std::io::Error> {
9898
let cookie = std::fs::read_to_string(&self.cookie_file)?;
9999
Ok(self::ConnectParams::parse_cookie(cookie))
100100
}
101101
}
102102

103-
/// Enum to specify p2p settings
103+
/// Enum to specify p2p settings.
104104
#[derive(Debug, PartialEq, Eq, Clone)]
105105
pub enum P2P {
106-
/// the node doesn't open a p2p port and work in standalone mode
106+
/// the node doesn't open a p2p port and work in standalone mode.
107107
No,
108-
/// the node open a p2p port
108+
/// the node open a p2p port.
109109
Yes,
110110
/// The node open a p2p port and also connects to the url given as parameter, it's handy to
111111
/// initialize this with [Node::p2p_connect] of another node. The `bool` parameter indicates
112112
/// if the node can accept connection too.
113113
Connect(SocketAddrV4, bool),
114114
}
115115

116-
/// All the possible error in this crate
116+
/// All the possible error in this crate.
117117
pub enum Error {
118-
/// Wrapper of io Error
118+
/// Wrapper of io Error.
119119
Io(std::io::Error),
120-
/// Wrapper of bitcoincore_rpc Error
120+
/// Wrapper of bitcoincore_rpc Error.
121121
Rpc(client_sync::Error),
122-
/// Returned when calling methods requiring a feature to be activated, but it's not
122+
/// Returned when calling methods requiring a feature to be activated, but it's not.
123123
NoFeature,
124-
/// Returned when calling methods requiring a env var to exist, but it's not
124+
/// Returned when calling methods requiring a env var to exist, but it's not.
125125
NoEnvVar,
126126
/// Returned when calling methods requiring the bitcoind executable but none is found
127-
/// (no feature, no `BITCOIND_EXE`, no `bitcoind` in `PATH` )
127+
/// (no feature, no `BITCOIND_EXE`, no `bitcoind` in `PATH` ).
128128
NoBitcoindExecutableFound,
129-
/// Wrapper of early exit status
129+
/// Wrapper of early exit status.
130130
EarlyExit(ExitStatus),
131-
/// Returned when both tmpdir and staticdir is specified in `Conf` options
131+
/// Returned when both tmpdir and staticdir is specified in `Conf` options.
132132
BothDirsSpecified,
133-
/// Returned when -rpcuser and/or -rpcpassword is used in `Conf` args
134-
/// It will soon be deprecated, please use -rpcauth instead
133+
/// Returned when -rpcuser and/or -rpcpassword is used in `Conf` args.
134+
/// It will soon be deprecated, please use -rpcauth instead.
135135
RpcUserAndPasswordUsed,
136-
/// Returned when expecting an auto-downloaded executable but `BITCOIND_SKIP_DOWNLOAD` env var is set
136+
/// Returned when expecting an auto-downloaded executable but `BITCOIND_SKIP_DOWNLOAD` env var is set.
137137
SkipDownload,
138138
/// Returned when bitcoind could not be reached after multiple attempts.
139139
/// The attached string, if present, contains the error encountered when trying to connect.
@@ -214,14 +214,14 @@ pub struct Conf<'a> {
214214
/// cannot be used because they are automatically initialized.
215215
pub args: Vec<&'a str>,
216216

217-
/// if `true` bitcoind log output will not be suppressed
217+
/// if `true` bitcoind log output will not be suppressed.
218218
pub view_stdout: bool,
219219

220-
/// Allows to specify options to open p2p port or connect to the another node
220+
/// Allows to specify options to open p2p port or connect to the another node.
221221
pub p2p: P2P,
222222

223223
/// Must match what specified in args without dashes, needed to locate the cookie file
224-
/// directory with different/esoteric networks
224+
/// directory with different/esoteric networks.
225225
pub network: &'a str,
226226

227227
/// Temporary directory path.
@@ -239,10 +239,10 @@ pub struct Conf<'a> {
239239
/// mode, as it cause memory overflows.
240240
pub tmpdir: Option<PathBuf>,
241241

242-
/// Persistent directory path
242+
/// Persistent directory path.
243243
pub staticdir: Option<PathBuf>,
244244

245-
/// Try to spawn the process `attempt` time
245+
/// Try to spawn the process `attempt` time.
246246
///
247247
/// The OS is giving available ports to use, however, they aren't booked, so it could rarely
248248
/// happen they are used at the time the process is spawn. When retrying other available ports
@@ -275,7 +275,7 @@ impl Default for Conf<'_> {
275275
impl Node {
276276
/// Launch the bitcoind process from the given `exe` executable with default args.
277277
///
278-
/// Waits for the node to be ready to accept connections before returning
278+
/// Waits for the node to be ready to accept connections before returning.
279279
pub fn new<S: AsRef<OsStr>>(exe: S) -> anyhow::Result<Node> {
280280
Node::with_conf(exe, &Conf::default())
281281
}
@@ -435,8 +435,8 @@ impl Node {
435435
///
436436
/// # Parameters
437437
/// * `enable_zmq` - If `true`, creates two ZMQ sockets:
438-
/// - `zmq_pub_raw_tx_socket`: for raw transaction publishing
439-
/// - `zmq_pub_raw_block_socket`: for raw block publishing
438+
/// - `zmq_pub_raw_tx_socket`: for raw transaction publishing.
439+
/// - `zmq_pub_raw_block_socket`: for raw block publishing.
440440
fn zmq_args(
441441
enable_zmq: bool,
442442
) -> anyhow::Result<(Vec<String>, Option<SocketAddrV4>, Option<SocketAddrV4>)> {
@@ -522,31 +522,31 @@ impl Node {
522522
Err(Error::NoBitcoindInstance("Could not create or load wallet".to_string()).into())
523523
}
524524

525-
/// Returns the rpc URL including the schema eg. http://127.0.0.1:44842
525+
/// Returns the rpc URL including the schema eg. http://127.0.0.1:44842.
526526
pub fn rpc_url(&self) -> String { format!("http://{}", self.params.rpc_socket) }
527527

528-
/// Returns the rpc URL including the schema and the given `wallet_name`
529-
/// eg. http://127.0.0.1:44842/wallet/my_wallet
528+
/// Returns the rpc URL including the schema and the given `wallet_name`.
529+
/// eg. http://127.0.0.1:44842/wallet/my_wallet.
530530
pub fn rpc_url_with_wallet<T: AsRef<str>>(&self, wallet_name: T) -> String {
531531
format!("http://{}/wallet/{}", self.params.rpc_socket, wallet_name.as_ref())
532532
}
533533

534-
/// Return the current workdir path of the running node
534+
/// Return the current workdir path of the running node.
535535
pub fn workdir(&self) -> PathBuf { self.work_dir.path() }
536536

537-
/// Returns the [P2P] enum to connect to this node p2p port
537+
/// Returns the [P2P] enum to connect to this node p2p port.
538538
pub fn p2p_connect(&self, listen: bool) -> Option<P2P> {
539539
self.params.p2p_socket.map(|s| P2P::Connect(s, listen))
540540
}
541541

542-
/// Stop the node, waiting correct process termination
542+
/// Stop the node, waiting correct process termination.
543543
pub fn stop(&mut self) -> anyhow::Result<ExitStatus> {
544544
self.client.stop()?;
545545
Ok(self.process.wait()?)
546546
}
547547

548548
/// Create a new wallet in the running node, and return an RPC client connected to the just
549-
/// created wallet
549+
/// created wallet.
550550
pub fn create_wallet<T: AsRef<str>>(&self, wallet: T) -> anyhow::Result<Client> {
551551
let _ = self.client.create_wallet(wallet.as_ref())?;
552552
Ok(Client::new_with_auth(
@@ -578,7 +578,7 @@ impl Drop for Node {
578578

579579
/// Returns a non-used local port if available.
580580
///
581-
/// Note there is a race condition during the time the method check availability and the caller
581+
/// Note there is a race condition during the time the method check availability and the caller.
582582
pub fn get_available_port() -> anyhow::Result<u16> {
583583
// using 0 as port let the system assign a port available
584584
let t = TcpListener::bind(("127.0.0.1", 0))?; // 0 means the OS choose a free port
@@ -593,11 +593,11 @@ impl From<client_sync::Error> for Error {
593593
fn from(e: client_sync::Error) -> Self { Error::Rpc(e) }
594594
}
595595

596-
/// Provide the bitcoind executable path if a version feature has been specified
596+
/// Provide the bitcoind executable path if a version feature has been specified.
597597
#[cfg(not(feature = "download"))]
598598
pub fn downloaded_exe_path() -> anyhow::Result<String> { Err(Error::NoFeature.into()) }
599599

600-
/// Provide the bitcoind executable path if a version feature has been specified
600+
/// Provide the bitcoind executable path if a version feature has been specified.
601601
#[cfg(feature = "download")]
602602
pub fn downloaded_exe_path() -> anyhow::Result<String> {
603603
if std::env::var_os("BITCOIND_SKIP_DOWNLOAD").is_some() {
@@ -621,10 +621,10 @@ pub fn downloaded_exe_path() -> anyhow::Result<String> {
621621

622622
/// Returns the daemon `bitcoind` executable with the following precedence:
623623
///
624-
/// 1) If it's specified in the `BITCOIND_EXE` env var
624+
/// 1) If it's specified in the `BITCOIND_EXE` env var.
625625
/// 2) If there is no env var but the auto-download feature is enabled, returns the
626-
/// path of the downloaded executable
627-
/// 3) If neither of the precedent are available, the `bitcoind` executable is searched in the `PATH`
626+
/// path of the downloaded executable.
627+
/// 3) If neither of the precedent are available, the `bitcoind` executable is searched in the `PATH`.
628628
pub fn exe_path() -> anyhow::Result<String> {
629629
if let Ok(path) = std::env::var("BITCOIND_EXE") {
630630
return Ok(path);
@@ -637,7 +637,7 @@ pub fn exe_path() -> anyhow::Result<String> {
637637
.map(|p| p.display().to_string())
638638
}
639639

640-
/// Validate the specified arg if there is any unavailable or deprecated one
640+
/// Validate the specified arg if there is any unavailable or deprecated one.
641641
pub fn validate_args(args: Vec<&str>) -> anyhow::Result<Vec<&str>> {
642642
args.iter().try_for_each(|arg| {
643643
// other kind of invalid arguments can be added into the list if needed

0 commit comments

Comments
 (0)