Skip to content

Commit

Permalink
Merge rust-bitcoin#131: Make write_err macro private
Browse files Browse the repository at this point in the history
98ea514 Make write_err macro private (Tobin C. Harding)

Pull request description:

  Currently the `write_err` macro appears in the public API, there is no real benefit in this, its just one more thing to commit to post v1.0.0

  Make the `write_err` macro private.

ACKs for top commit:
  clarkmoody:
    ACK 98ea514
  apoelstra:
    ACK 98ea514

Tree-SHA512: 8bd434bf81fe3f86da9f80d48ee0d6149b3f6b0169d2db2dc9d4cee00946b0a5025cc5e6b44ece90a610e67a6e4c5775559d3b8d19555db3e6e2e912bd0b1bb1
  • Loading branch information
apoelstra committed Sep 22, 2023
2 parents 175df94 + 98ea514 commit 41cf1bc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/// If `std` feature is OFF appends error source (delimited by `: `). We do this because
/// `e.source()` is only available in std builds, without this macro the error source is lost for
/// no-std builds.
#[macro_export]
macro_rules! write_err {
($writer:expr, $string:literal $(, $args:expr)*; $source:expr) => {
{
Expand All @@ -21,3 +20,4 @@ macro_rules! write_err {
}
}
}
pub(crate) use write_err;
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use alloc::{string::String, vec::Vec};
use core::convert::{Infallible, TryFrom};
use core::{fmt, mem};

use crate::error::write_err;
pub use crate::primitives::checksum::Checksum;
use crate::primitives::checksum::{self, PackedFe32};
pub use crate::primitives::gf32::Fe32;
Expand Down
3 changes: 2 additions & 1 deletion src/primitives/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@
use core::{fmt, iter, slice, str};

use crate::error::write_err;
use crate::primitives::checksum::{self, Checksum};
use crate::primitives::gf32::Fe32;
use crate::primitives::hrp::{self, Hrp};
use crate::primitives::iter::{Fe32IterExt, FesToBytes};
use crate::primitives::segwit::{self, WitnessLengthError, VERSION_0};
use crate::{write_err, Bech32, Bech32m};
use crate::{Bech32, Bech32m};

/// Separator between the hrp and payload (as defined by BIP-173).
const SEP: char = '1';
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/gf32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use core::{fmt, num, ops};
#[cfg(all(test, mutate))]
use mutagen::mutate;

use crate::write_err;
use crate::error::write_err;

/// Logarithm table of each bech32 element, as a power of alpha = Z.
///
Expand Down
2 changes: 1 addition & 1 deletion src/segwit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
use alloc::{string::String, vec::Vec};
use core::fmt;

use crate::error::write_err;
#[cfg(feature = "alloc")]
use crate::primitives::decode::{SegwitHrpstring, SegwitHrpstringError};
use crate::primitives::gf32::Fe32;
Expand All @@ -53,7 +54,6 @@ use crate::primitives::iter::{ByteIterExt, Fe32IterExt};
use crate::primitives::segwit::{self, InvalidWitnessVersionError, WitnessLengthError};
pub use crate::primitives::segwit::{VERSION_0, VERSION_1};
use crate::primitives::{Bech32, Bech32m};
use crate::write_err;

/// Decodes a segwit address.
///
Expand Down

0 comments on commit 41cf1bc

Please sign in to comment.