Skip to content

Commit 8ffd138

Browse files
committed
Merge #134: Do some docs fixes
ea97465 Remove backticks for bip names (Tobin C. Harding) 8dec93d Drop docs usage of "higher" (Tobin C. Harding) 6280935 Update "crate level API" docs (Tobin C. Harding) 521d963 Fix incorrect HRP docs (Tobin C. Harding) 9f7c21a Fix links (Tobin C. Harding) d432a4f Fix rendered module docs (Tobin C. Harding) Pull request description: Do a bunch of rustdocs fixes. ACKs for top commit: clarkmoody: ACK ea97465 apoelstra: ACK ea97465 Tree-SHA512: 59505d57f5bfe12364e3fef1daaf5d45e6b4a317b1d64d2173283a5563326a919fdc5faa4d0de0b199339b00b528b1a358c43347b8bdd0effb303d5e186de222
2 parents cb2f61e + ea97465 commit 8ffd138

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

src/hrp.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
// SPDX-License-Identifier: MIT
22

3+
//! Re-exports the hrp types from [`primitives::hrp`] to make importing ergonomic for the top level APIs.
4+
//!
5+
//! [`primitives::hrp`]: crate::primitives::hrp
6+
37
#[doc(inline)]
48
pub use crate::primitives::hrp::{Hrp, BC, BCRT, TB};

src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,8 @@ extern crate alloc;
141141
extern crate core;
142142

143143
mod error;
144-
/// Re-exports the hrp types from [`primitives::hrp`] to make importing ergonomic for the top level APIs.
145144
pub mod hrp;
146-
/// All the primitive types and functionality used in encoding and decoding.
147145
pub mod primitives;
148-
/// API for encoding and decoding segwit addresses.
149146
pub mod segwit;
150147

151148
#[cfg(all(feature = "alloc", not(feature = "std"), not(test)))]

src/primitives/decode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! You should only need to use this module directly if you want control over exactly what is
66
//! checked and when it is checked (correct bech32 characters, valid checksum, valid checksum for
77
//! specific checksum algorithm, etc). If you are parsing/validating modern (post BIP-350) bitcoin
8-
//! segwit addresses consider using the higher crate level API.
8+
//! segwit addresses consider using the [`crate::segwit`] API.
99
//!
1010
//! If you do find yourself using this module directly then consider using the most general type
1111
//! that serves your purposes, each type can be created by parsing an address string to `new`. You

src/primitives/encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! prepending HRP strings etc.
88
//!
99
//! In general, directly using these adaptors is not very ergonomic, and users are recommended to
10-
//! instead use the higher-level functions at the root of this crate.
10+
//! instead use the crate level API.
1111
//!
1212
//! WARNING: This module does not enforce the maximum length of an encoded bech32 string (90 chars).
1313
//!

src/primitives/hrp.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl Hrp {
191191
#[allow(clippy::len_without_is_empty)] // HRP is never empty.
192192
pub fn len(&self) -> usize { self.size }
193193

194-
/// Returns `true` if this [`Hrp`] is valid according to the bips.
194+
/// Returns `true` if this HRP is valid according to the bips.
195195
///
196196
/// [BIP-173] states that the HRP must be either "bc" or "tb".
197197
///
@@ -201,19 +201,19 @@ impl Hrp {
201201
self.is_valid_on_mainnet() || self.is_valid_on_testnet()
202202
}
203203

204-
/// Returns `true` if this hrpstring is valid on the Bitcoin network i.e., HRP is "bc".
204+
/// Returns `true` if this HRP is valid on the Bitcoin network i.e., HRP is "bc".
205205
#[inline]
206206
pub fn is_valid_on_mainnet(&self) -> bool { *self == self::BC }
207207

208-
/// Returns `true` if this hrpstring is valid on the Bitcoin testnet network i.e., HRP is "tb".
208+
/// Returns `true` if this HRP is valid on the Bitcoin testnet network i.e., HRP is "tb".
209209
#[inline]
210210
pub fn is_valid_on_testnet(&self) -> bool { *self == self::TB }
211211

212-
/// Returns `true` if this hrpstring is valid on the Bitcoin signet network i.e., HRP is "tb".
212+
/// Returns `true` if this HRP is valid on the Bitcoin signet network i.e., HRP is "tb".
213213
#[inline]
214214
pub fn is_valid_on_signet(&self) -> bool { *self == self::TB }
215215

216-
/// Returns `true` if this hrpstring is valid on the Bitcoin regtest network i.e., HRP is "bcrt".
216+
/// Returns `true` if this HRP is valid on the Bitcoin regtest network i.e., HRP is "bcrt".
217217
#[inline]
218218
pub fn is_valid_on_regtest(&self) -> bool { *self == self::BCRT }
219219
}

src/primitives/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub enum Bech32 {}
2424

2525
/// The bech32m checksum algorithm, defined in [BIP-350].
2626
///
27-
/// [BIP-350]: <https://github.com/bitcoin/bips/blob/master/bip-0359.mediawiki>
27+
/// [BIP-350]: <https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki>
2828
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2929
pub enum Bech32m {}
3030

src/segwit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ pub fn decode(s: &str) -> Result<(Hrp, Fe32, Vec<u8>), DecodeError> {
8989
/// Does validity checks on the `witness_version`, length checks on the `witness_program`, and
9090
/// checks the total encoded string length.
9191
///
92-
/// As specified by [`BIP-350`] we use the [`Bech32m`] checksum algorithm for witness versions 1 and
93-
/// above, and for witness version 0 we use the original ([`BIP-173`]) [`Bech32`] checksum
92+
/// As specified by [BIP-350] we use the [`Bech32m`] checksum algorithm for witness versions 1 and
93+
/// above, and for witness version 0 we use the original ([BIP-173]) [`Bech32`] checksum
9494
/// algorithm.
9595
///
9696
/// See also [`encode_v0`] or [`encode_v1`].

0 commit comments

Comments
 (0)