dc1e377d4e Improve docs on rustsecp256k1_v0_4_1_context_create (Tobin C. Harding)
ad153d82f7 Add safety rustdoc headings (Tobin C. Harding)

Pull request description:

  Do some minor docs improvements.

  Done in an effort to clear _all_ clippy warnings from the codebase.

ACKs for top commit:
  sanket1729:
    ACK dc1e377d4e
  apoelstra:
    ACK dc1e377d4e

Tree-SHA512: 9b7e3ff05a6ea05bde5df49bbfcc6eb2c7097b4d9b600dedeb8fef4e3cbdd56a357fd0846ca51cb32f0957bca1335ff3b4b0d771046481ab95447af99d6a2d9c
This commit is contained in:
Andrew Poelstra 2022-04-30 16:10:35 +00:00
commit f02ff65102
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 23 additions and 5 deletions

View File

@ -109,6 +109,8 @@ impl_raw_debug!(PublicKey);
impl PublicKey { impl PublicKey {
/// Creates an "uninitialized" FFI public key which is zeroed out /// Creates an "uninitialized" FFI public key which is zeroed out
/// ///
/// # Safety
///
/// If you pass this to any FFI functions, except as an out-pointer, /// If you pass this to any FFI functions, except as an out-pointer,
/// the result is likely to be an assertation failure and process /// the result is likely to be an assertation failure and process
/// termination. /// termination.
@ -118,6 +120,8 @@ impl PublicKey {
/// Create a new public key usable for the FFI interface from raw bytes /// Create a new public key usable for the FFI interface from raw bytes
/// ///
/// # Safety
///
/// Does not check the validity of the underlying representation. If it is /// Does not check the validity of the underlying representation. If it is
/// invalid the result may be assertation failures (and process aborts) from /// invalid the result may be assertation failures (and process aborts) from
/// the underlying library. You should not use this method except with data /// the underlying library. You should not use this method except with data
@ -145,6 +149,8 @@ impl_raw_debug!(Signature);
impl Signature { impl Signature {
/// Creates an "uninitialized" FFI signature which is zeroed out /// Creates an "uninitialized" FFI signature which is zeroed out
/// ///
/// # Safety
///
/// If you pass this to any FFI functions, except as an out-pointer, /// If you pass this to any FFI functions, except as an out-pointer,
/// the result is likely to be an assertation failure and process /// the result is likely to be an assertation failure and process
/// termination. /// termination.
@ -154,6 +160,8 @@ impl Signature {
/// Create a new signature usable for the FFI interface from raw bytes /// Create a new signature usable for the FFI interface from raw bytes
/// ///
/// # Safety
///
/// Does not check the validity of the underlying representation. If it is /// Does not check the validity of the underlying representation. If it is
/// invalid the result may be assertation failures (and process aborts) from /// invalid the result may be assertation failures (and process aborts) from
/// the underlying library. You should not use this method except with data /// the underlying library. You should not use this method except with data
@ -180,6 +188,8 @@ impl_raw_debug!(XOnlyPublicKey);
impl XOnlyPublicKey { impl XOnlyPublicKey {
/// Creates an "uninitialized" FFI x-only public key which is zeroed out /// Creates an "uninitialized" FFI x-only public key which is zeroed out
/// ///
/// # Safety
///
/// If you pass this to any FFI functions, except as an out-pointer, /// If you pass this to any FFI functions, except as an out-pointer,
/// the result is likely to be an assertation failure and process /// the result is likely to be an assertation failure and process
/// termination. /// termination.
@ -189,6 +199,8 @@ impl XOnlyPublicKey {
/// Create a new x-only public key usable for the FFI interface from raw bytes /// Create a new x-only public key usable for the FFI interface from raw bytes
/// ///
/// # Safety
///
/// Does not check the validity of the underlying representation. If it is /// Does not check the validity of the underlying representation. If it is
/// invalid the result may be assertation failures (and process aborts) from /// invalid the result may be assertation failures (and process aborts) from
/// the underlying library. You should not use this method except with data /// the underlying library. You should not use this method except with data
@ -215,6 +227,8 @@ impl_raw_debug!(KeyPair);
impl KeyPair { impl KeyPair {
/// Creates an "uninitialized" FFI keypair which is zeroed out /// Creates an "uninitialized" FFI keypair which is zeroed out
/// ///
/// # Safety
///
/// If you pass this to any FFI functions, except as an out-pointer, /// If you pass this to any FFI functions, except as an out-pointer,
/// the result is likely to be an assertation failure and process /// the result is likely to be an assertation failure and process
/// termination. /// termination.
@ -224,6 +238,8 @@ impl KeyPair {
/// Create a new keypair usable for the FFI interface from raw bytes /// Create a new keypair usable for the FFI interface from raw bytes
/// ///
/// # Safety
///
/// Does not check the validity of the underlying representation. If it is /// Does not check the validity of the underlying representation. If it is
/// invalid the result may be assertation failures (and process aborts) from /// invalid the result may be assertation failures (and process aborts) from
/// the underlying library. You should not use this method except with data /// the underlying library. You should not use this method except with data
@ -519,12 +535,14 @@ extern "C" {
/// A reimplementation of the C function `secp256k1_context_create` in rust. /// A reimplementation of the C function `secp256k1_context_create` in rust.
/// ///
/// This function allocates memory, the pointer should be deallocated using `secp256k1_context_destroy` /// This function allocates memory, the pointer should be deallocated using
/// A failure to do so will result in a memory leak. /// `secp256k1_context_destroy`. Failure to do so will result in a memory leak.
/// ///
/// This will create a secp256k1 raw context. /// Input `flags` control which parts of the context to initialize.
// Returns: a newly created context object. ///
// In: flags: which parts of the context to initialize. /// # Returns
///
/// The newly created secp256k1 raw context.
#[no_mangle] #[no_mangle]
#[cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))] #[cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))))] #[cfg_attr(docsrs, doc(cfg(all(feature = "std", not(rust_secp_no_symbol_renaming)))))]