Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve public re-exports #137

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,35 +130,35 @@ extern crate alloc;
#[cfg(any(test, feature = "std"))]
extern crate core;

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

#[cfg(all(feature = "alloc", not(feature = "std"), not(test)))]
use alloc::{string::String, vec::Vec};
use core::fmt;

use crate::error::write_err;
#[doc(inline)]
pub use crate::primitives::checksum::Checksum;
#[cfg(doc)]
use crate::primitives::decode::CheckedHrpstring;
#[cfg(feature = "alloc")]
use crate::primitives::decode::UncheckedHrpstringError;
#[cfg(feature = "alloc")]
use crate::primitives::decode::{ChecksumError, UncheckedHrpstring};
#[doc(inline)]
pub use crate::primitives::gf32::Fe32;
#[doc(inline)]
pub use crate::primitives::hrp::Hrp;
#[doc(inline)]
pub use crate::primitives::iter::{ByteIterExt, Fe32IterExt};
#[doc(inline)]
pub use crate::primitives::{Bech32, Bech32m, NoChecksum};

mod error;
/// Re-exports the hrp types from [`primitives::hrp`] to make importing ergonomic for the top level APIs.
pub mod hrp;
/// All the primitive types and functionality used in encoding and decoding.
pub mod primitives;
/// API for encoding and decoding segwit addresses.
pub mod segwit;
#[rustfmt::skip] // Keep public re-exports separate.
#[doc(inline)]
pub use {
crate::primitives::checksum::Checksum,
crate::primitives::gf32::Fe32,
crate::primitives::hrp::Hrp,
crate::primitives::iter::{ByteIterExt, Fe32IterExt},
crate::primitives::{Bech32, Bech32m, NoChecksum},
};

/// Decodes a bech32 encoded string.
///
Expand Down
8 changes: 6 additions & 2 deletions src/segwit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ use crate::primitives::iter::{ByteIterExt, Fe32IterExt};
#[cfg(feature = "alloc")]
use crate::primitives::segwit;
use crate::primitives::segwit::{InvalidWitnessVersionError, WitnessLengthError};
#[doc(inline)]
pub use crate::primitives::segwit::{VERSION_0, VERSION_1};
use crate::primitives::{Bech32, Bech32m};

#[rustfmt::skip] // Keep public re-exports separate.
#[doc(inline)]
pub use {
crate::primitives::segwit::{VERSION_0, VERSION_1},
};

/// Decodes a segwit address.
///
/// # Examples
Expand Down
Loading