Skip to content

Commit 2e5f65b

Browse files
committed
Merge #853: Improve root level imports and exports
4e44e6f Inline the re-exports (Tobin C. Harding) 8a73ead Put public re-exports separately (Tobin C. Harding) bea8f94 Re-export context from crate::context (Tobin C. Harding) 8b3f097 Put the secp256k1-sys re-export separately (Tobin C. Harding) 302c362 Group private modules (Tobin C. Harding) 6007659 Use pub extern crate instead of pub use (Tobin C. Harding) Pull request description: Do a bunch of trivial clean ups to the imports and exports in `lib.rs`. Done as tiny patches to make review trivial. The only meaningful change, apart from leaving the code awesomely clean, is the `Scalar` type moving sections in rendered HTML docs. ACKs for top commit: apoelstra: ACK 4e44e6f; successfully ran local tests Tree-SHA512: fb3796211bb71a30c86eb16109526c8866137b46d1cd2e60857859dd0934b5015d1ea227f57e7b8d7f95403ac2dec98442ae96b144bbd21762dc2ad74a650efd
2 parents 7d8d547 + 4e44e6f commit 2e5f65b

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

src/lib.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,19 @@ extern crate core;
163163
#[cfg(bench)]
164164
extern crate test;
165165

166+
#[cfg(feature = "rand")]
167+
pub extern crate rand;
168+
#[cfg(feature = "serde")]
169+
pub extern crate serde;
170+
166171
#[macro_use]
167172
mod macros;
168173
#[macro_use]
169174
mod secret;
170175
mod context;
171176
mod key;
177+
#[cfg(feature = "serde")]
178+
mod serde_util;
172179

173180
pub mod constants;
174181
pub mod ecdh;
@@ -177,32 +184,31 @@ pub mod ellswift;
177184
pub mod musig;
178185
pub mod scalar;
179186
pub mod schnorr;
180-
#[cfg(feature = "serde")]
181-
mod serde_util;
182187

183188
use core::marker::PhantomData;
184189
use core::ptr::NonNull;
185190
use core::{fmt, mem, str};
186191

187-
#[cfg(all(feature = "global-context", feature = "std"))]
188-
pub use context::global::{self, SECP256K1};
189-
#[cfg(feature = "rand")]
190-
pub use rand;
192+
use crate::ffi::types::AlignedType;
193+
use crate::ffi::CPtr;
194+
195+
#[rustfmt::skip] // Keep public re-exports separate.
191196
pub use secp256k1_sys as ffi;
192-
#[cfg(feature = "serde")]
193-
pub use serde;
194197

195-
pub use crate::context::{
196-
rerandomize_global_context, with_global_context, with_raw_global_context, AllPreallocated,
197-
Context, PreallocatedContext, SignOnlyPreallocated, Signing, Verification,
198-
VerifyOnlyPreallocated,
199-
};
198+
#[cfg(all(feature = "global-context", feature = "std"))]
199+
pub use crate::context::global::{self, SECP256K1};
200200
#[cfg(feature = "alloc")]
201201
pub use crate::context::{All, SignOnly, VerifyOnly};
202-
use crate::ffi::types::AlignedType;
203-
use crate::ffi::CPtr;
204-
pub use crate::key::{InvalidParityValue, Keypair, Parity, PublicKey, SecretKey, XOnlyPublicKey};
205-
pub use crate::scalar::Scalar;
202+
#[doc(inline)]
203+
pub use crate::{
204+
context::{
205+
rerandomize_global_context, with_global_context, with_raw_global_context, AllPreallocated,
206+
Context, PreallocatedContext, SignOnlyPreallocated, Signing, Verification,
207+
VerifyOnlyPreallocated,
208+
},
209+
key::{InvalidParityValue, Keypair, Parity, PublicKey, SecretKey, XOnlyPublicKey},
210+
scalar::Scalar,
211+
};
206212

207213
/// Trait describing something that promises to be a 32-byte uniformly random number.
208214
///

0 commit comments

Comments
 (0)