diff --git a/src/lib.rs b/src/lib.rs index ee0fe5a98..238ad2005 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -163,12 +163,19 @@ extern crate core; #[cfg(bench)] extern crate test; +#[cfg(feature = "rand")] +pub extern crate rand; +#[cfg(feature = "serde")] +pub extern crate serde; + #[macro_use] mod macros; #[macro_use] mod secret; mod context; mod key; +#[cfg(feature = "serde")] +mod serde_util; pub mod constants; pub mod ecdh; @@ -177,32 +184,31 @@ pub mod ellswift; pub mod musig; pub mod scalar; pub mod schnorr; -#[cfg(feature = "serde")] -mod serde_util; use core::marker::PhantomData; use core::ptr::NonNull; use core::{fmt, mem, str}; -#[cfg(all(feature = "global-context", feature = "std"))] -pub use context::global::{self, SECP256K1}; -#[cfg(feature = "rand")] -pub use rand; +use crate::ffi::types::AlignedType; +use crate::ffi::CPtr; + +#[rustfmt::skip] // Keep public re-exports separate. pub use secp256k1_sys as ffi; -#[cfg(feature = "serde")] -pub use serde; -pub use crate::context::{ - rerandomize_global_context, with_global_context, with_raw_global_context, AllPreallocated, - Context, PreallocatedContext, SignOnlyPreallocated, Signing, Verification, - VerifyOnlyPreallocated, -}; +#[cfg(all(feature = "global-context", feature = "std"))] +pub use crate::context::global::{self, SECP256K1}; #[cfg(feature = "alloc")] pub use crate::context::{All, SignOnly, VerifyOnly}; -use crate::ffi::types::AlignedType; -use crate::ffi::CPtr; -pub use crate::key::{InvalidParityValue, Keypair, Parity, PublicKey, SecretKey, XOnlyPublicKey}; -pub use crate::scalar::Scalar; +#[doc(inline)] +pub use crate::{ + context::{ + rerandomize_global_context, with_global_context, with_raw_global_context, AllPreallocated, + Context, PreallocatedContext, SignOnlyPreallocated, Signing, Verification, + VerifyOnlyPreallocated, + }, + key::{InvalidParityValue, Keypair, Parity, PublicKey, SecretKey, XOnlyPublicKey}, + scalar::Scalar, +}; /// Trait describing something that promises to be a 32-byte uniformly random number. ///