Skip to content

Commit 99f6add

Browse files
Unify hyperlinks across documentation
1 parent 6d489a7 commit 99f6add

File tree

7 files changed

+37
-17
lines changed

7 files changed

+37
-17
lines changed

src/lib.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515
//! - Non-segwit stuff and you have an allocator, use the top level API. For normal usage the
1616
//! [`encode`] and [`decode`] functions should suffice. There are also various other functions for
1717
//! explicit control of the checksum algorithm and the case used when encoding.
18-
//! - Non-segwit stuff and you do *not* have an allocator, use the
19-
//! [`primitives::decode::CheckedHrpstring`] type for decoding. For encoding we provide various
20-
//! top level functions of the form `encode*_to_fmt`.
21-
//! - To define your own checksum algorithm implement [`crate::Checksum`] (see example below).
18+
//! - Non-segwit stuff and you do *not* have an allocator, use the [`CheckedHrpstring`] type for
19+
//! decoding. For encoding we provide various top level functions of the form `encode*_to_fmt`.
20+
//! - To define your own checksum algorithm implement [`Checksum`] (see example below).
2221
//!
23-
//! The original description in [BIP-0173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)
24-
//! has more details. See also [BIP-0350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki).
22+
//! The original description in [BIP-173] has more details. See also [BIP-350].
2523
//!
2624
//! # Deviation from spec
2725
//!
@@ -121,6 +119,9 @@
121119
//! # }
122120
//! ```
123121
//!
122+
//! [BIP-173]: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki>
123+
//! [BIP-350]: <https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki>
124+
//! [`CheckedHrpstring`]: crate::primitives::decode::CheckedHrpstring
124125
//! [`Checksum::CODE_LENGTH`]: crate::primitives::checksum::Checksum::CODE_LENGTH
125126
126127
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
@@ -339,10 +340,12 @@ pub fn encode_upper_to_fmt<Ck: Checksum, W: fmt::Write>(
339340
Ok(())
340341
}
341342

342-
/// Encodes `data` to a writer ([`std::io::Write`]) as a lowercase bech32 encoded string.
343+
/// Encodes `data` to a writer ([`io::Write`]) as a lowercase bech32 encoded string.
343344
///
344345
/// Encoded string will be prefixed with the `hrp` and have a checksum appended as specified by the
345346
/// `Ck` algorithm (`NoChecksum` to exclude checksum all together).
347+
///
348+
/// [`io::Write`]: std::io::Write
346349
#[cfg(feature = "std")]
347350
#[inline]
348351
pub fn encode_to_writer<Ck: Checksum, W: std::io::Write>(
@@ -353,10 +356,12 @@ pub fn encode_to_writer<Ck: Checksum, W: std::io::Write>(
353356
encode_lower_to_writer::<Ck, W>(w, hrp, data)
354357
}
355358

356-
/// Encodes `data` to a writer ([`std::io::Write`]) as a lowercase bech32 encoded string.
359+
/// Encodes `data` to a writer ([`io::Write`]) as a lowercase bech32 encoded string.
357360
///
358361
/// Encoded string will be prefixed with the `hrp` and have a checksum appended as specified by the
359362
/// `Ck` algorithm (`NoChecksum` to exclude checksum all together).
363+
///
364+
/// [`io::Write`]: std::io::Write
360365
#[cfg(feature = "std")]
361366
#[inline]
362367
pub fn encode_lower_to_writer<Ck: Checksum, W: std::io::Write>(
@@ -386,10 +391,12 @@ pub fn encode_lower_to_writer<Ck: Checksum, W: std::io::Write>(
386391
Ok(())
387392
}
388393

389-
/// Encodes `data` to a writer ([`std::io::Write`]) as a uppercase bech32 encoded string.
394+
/// Encodes `data` to a writer ([`io::Write`]) as a uppercase bech32 encoded string.
390395
///
391396
/// Encoded string will be prefixed with the `hrp` and have a checksum appended as specified by the
392397
/// `Ck` algorithm (`NoChecksum` to exclude checksum all together).
398+
///
399+
/// [`io::Write`]: std::io::Write
393400
#[cfg(feature = "std")]
394401
#[inline]
395402
pub fn encode_upper_to_writer<Ck: Checksum, W: std::io::Write>(

src/primitives/checksum.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ pub trait PackedFe32: Copy + PartialEq + Eq + ops::BitXor<Self, Output = Self> {
165165
fn mul_by_x_then_add(&mut self, degree: usize, add: u8) -> u8;
166166
}
167167

168-
/// A placeholder type used as part of the [`crate::primitives::NoChecksum`] "checksum".
168+
/// A placeholder type used as part of the [`NoChecksum`] "checksum".
169+
///
170+
/// [`NoChecksum`]: crate::primitives::NoChecksum
169171
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
170172
pub struct PackedNull;
171173

src/primitives/gf32.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
//! GF32 - Galois Field over 32 elements.
44
//!
5-
//! Implements GF32 arithmetic, defined and encoded as in BIP-0173 "bech32".
5+
//! Implements GF32 arithmetic, defined and encoded as in [BIP-173] "bech32".
66
//!
77
//! > A finite field is a finite set which is a field; this means that multiplication, addition,
88
//! > subtraction and division (excluding division by zero) are defined and satisfy the rules of
99
//! > arithmetic known as the field axioms.
1010
//!
1111
//! ref: <https://en.wikipedia.org/wiki/Finite_field>
12+
//!
13+
//! [BIP-173]: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki>
1214
1315
use core::convert::{Infallible, TryFrom};
1416
use core::{fmt, num, ops};

src/primitives/hrp.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
//! Provides an `Hrp` type that represents the human-readable part of a bech32 encoded string.
3+
//! Provides an [`Hrp`] type that represents the human-readable part of a bech32 encoded string.
44
//!
55
//! > The human-readable part, which is intended to convey the type of data, or anything else that
66
//! > is relevant to the reader. This part MUST contain 1 to 83 US-ASCII characters, with each
@@ -195,7 +195,7 @@ impl Hrp {
195195
///
196196
/// [BIP-173] states that the HRP must be either "bc" or "tb".
197197
///
198-
/// [BIP-173]: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#user-content-Segwit_address_format
198+
/// [BIP-173]: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#user-content-Segwit_address_format>
199199
#[inline]
200200
pub fn is_valid_segwit(&self) -> bool {
201201
self.is_valid_on_mainnet() || self.is_valid_on_testnet()
@@ -371,6 +371,7 @@ impl<'b> FusedIterator for LowercaseCharIter<'b> {}
371371
fn is_ascii_uppercase(b: u8) -> bool { (65..=90).contains(&b) }
372372

373373
/// Errors encountered while checking the human-readable part as defined by [BIP-173].
374+
///
374375
/// [BIP-173]: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#user-content-Bech32>
375376
#[derive(Clone, Debug, PartialEq, Eq)]
376377
#[non_exhaustive]

src/primitives/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ use checksum::{Checksum, PackedNull};
1717
pub enum NoChecksum {}
1818

1919
/// The bech32 checksum algorithm, defined in [BIP-173].
20+
///
2021
/// [BIP-173]: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki>
2122
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2223
pub enum Bech32 {}
2324

2425
/// The bech32m checksum algorithm, defined in [BIP-350].
26+
///
2527
/// [BIP-350]: <https://github.com/bitcoin/bips/blob/master/bip-0359.mediawiki>
2628
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2729
pub enum Bech32m {}

src/primitives/segwit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
//! Segregated Witness functionality - useful for enforcing parts of [`BIP-173`] and [`BIP-350`].
3+
//! Segregated Witness functionality - useful for enforcing parts of [BIP-173] and [BIP-350].
44
//!
55
//! [BIP-173]: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki>
66
//! [BIP-350]: <https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki>

src/segwit.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,12 @@ pub fn encode_upper_to_fmt_unchecked<W: fmt::Write>(
227227
Ok(())
228228
}
229229

230-
/// Encodes a segwit address to a writer ([`std::io::Write`]) using lowercase characters.
230+
/// Encodes a segwit address to a writer ([`io::Write`]) using lowercase characters.
231231
///
232232
/// There are no guarantees that the written string is a valid segwit address unless all the
233233
/// parameters are valid. See the body of `encode()` to see the validity checks required.
234+
///
235+
/// [`io::Write`]: std::io::Write
234236
#[cfg(feature = "std")]
235237
#[inline]
236238
pub fn encode_to_writer_unchecked<W: std::io::Write>(
@@ -242,10 +244,12 @@ pub fn encode_to_writer_unchecked<W: std::io::Write>(
242244
encode_lower_to_writer_unchecked(w, hrp, witness_version, witness_program)
243245
}
244246

245-
/// Encodes a segwit address to a writer ([`std::io::Write`]) using lowercase characters.
247+
/// Encodes a segwit address to a writer ([`io::Write`]) using lowercase characters.
246248
///
247249
/// There are no guarantees that the written string is a valid segwit address unless all the
248250
/// parameters are valid. See the body of `encode()` to see the validity checks required.
251+
///
252+
/// [`io::Write`]: std::io::Write
249253
#[cfg(feature = "std")]
250254
#[inline]
251255
pub fn encode_lower_to_writer_unchecked<W: std::io::Write>(
@@ -280,12 +284,14 @@ pub fn encode_lower_to_writer_unchecked<W: std::io::Write>(
280284
Ok(())
281285
}
282286

283-
/// Encodes a segwit address to a [`std::io::Write`] writer using uppercase characters.
287+
/// Encodes a segwit address to a [`io::Write`] writer using uppercase characters.
284288
///
285289
/// This is provided for use when creating QR codes.
286290
///
287291
/// There are no guarantees that the written string is a valid segwit address unless all the
288292
/// parameters are valid. See the body of `encode()` to see the validity checks required.
293+
///
294+
/// [`io::Write`]: std::io::Write
289295
#[cfg(feature = "std")]
290296
#[inline]
291297
pub fn encode_upper_to_writer_unchecked<W: std::io::Write>(

0 commit comments

Comments
 (0)