Standardize function doc Safety, Returns and Parameters
Changed the function docs to have the same format of /// /// # Safety /// /// description
This commit is contained in:
parent
df83016c98
commit
11bb1ff6ff
|
@ -46,7 +46,7 @@ mod primitive {
|
|||
impl PushBytes {
|
||||
/// Creates `&Self` without checking the length.
|
||||
///
|
||||
/// ## Safety
|
||||
/// # Safety
|
||||
///
|
||||
/// The caller is responsible for checking that the length is less than the [`LIMIT`].
|
||||
unsafe fn from_slice_unchecked(bytes: &[u8]) -> &Self {
|
||||
|
@ -55,7 +55,7 @@ mod primitive {
|
|||
|
||||
/// Creates `&mut Self` without checking the length.
|
||||
///
|
||||
/// ## Safety
|
||||
/// # Safety
|
||||
///
|
||||
/// The caller is responsible for checking that the length is less than the [`LIMIT`].
|
||||
unsafe fn from_mut_slice_unchecked(bytes: &mut [u8]) -> &mut Self {
|
||||
|
|
|
@ -21,6 +21,7 @@ use crate::consensus::encode;
|
|||
/// [`bitcoinconsensus::VERIFY_ALL`].
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `index` - The input index in spending which is spending this transaction.
|
||||
/// * `amount` - The amount this script guards.
|
||||
/// * `spending_tx` - The transaction that attempts to spend the output holding this script.
|
||||
|
@ -38,6 +39,7 @@ pub fn verify_script(
|
|||
/// Verifies spend of an input script.
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `index` - The input index in spending which is spending this transaction.
|
||||
/// * `amount` - The amount this script guards.
|
||||
/// * `spending_tx` - The transaction that attempts to spend the output holding this script.
|
||||
|
@ -112,6 +114,7 @@ impl Script {
|
|||
/// Shorthand for [`Self::verify_with_flags`] with flag [`bitcoinconsensus::VERIFY_ALL`].
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `index` - The input index in spending which is spending this transaction.
|
||||
/// * `amount` - The amount this script guards.
|
||||
/// * `spending_tx` - The transaction that attempts to spend the output holding this script.
|
||||
|
@ -129,6 +132,7 @@ impl Script {
|
|||
/// Verifies spend of an input script.
|
||||
///
|
||||
/// # Parameters
|
||||
///
|
||||
/// * `index` - The input index in spending which is spending this transaction.
|
||||
/// * `amount` - The amount this script guards.
|
||||
/// * `spending_tx` - The transaction that attempts to spend the output holding this script.
|
||||
|
|
|
@ -747,6 +747,7 @@ pub trait TapTweak {
|
|||
/// * G is the generator point
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// The tweaked key and its parity.
|
||||
fn tap_tweak<C: Verification>(
|
||||
self,
|
||||
|
@ -776,6 +777,7 @@ impl TapTweak for UntweakedPublicKey {
|
|||
/// * G is the generator point
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// The tweaked key and its parity.
|
||||
fn tap_tweak<C: Verification>(
|
||||
self,
|
||||
|
@ -807,6 +809,7 @@ impl TapTweak for UntweakedKeypair {
|
|||
/// The public key is generated from a private key by multiplying with generator point, Q = qG.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// The tweaked key and its parity.
|
||||
fn tap_tweak<C: Verification>(
|
||||
self,
|
||||
|
|
|
@ -35,6 +35,7 @@ pub use self::block::{MerkleBlock, MerkleBlockError, PartialMerkleTree};
|
|||
/// this method and should not be used again afterwards).
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// - `None` if `hashes` is empty. The merkle root of an empty tree of hashes is undefined.
|
||||
/// - `Some(hash)` if `hashes` contains one element. A single hash is by definition the merkle root.
|
||||
/// - `Some(merkle_root)` if length of `hashes` is greater than one.
|
||||
|
@ -53,6 +54,7 @@ where
|
|||
/// Calculates the merkle root of an iterator of *hashes*.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// - `None` if `hashes` is empty. The merkle root of an empty tree of hashes is undefined.
|
||||
/// - `Some(hash)` if `hashes` contains one element. A single hash is by definition the merkle root.
|
||||
/// - `Some(merkle_root)` if length of `hashes` is greater than one.
|
||||
|
|
|
@ -739,6 +739,7 @@ pub trait GetKey {
|
|||
/// Attempts to get the private key for `key_request`.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// - `Some(key)` if the key is found.
|
||||
/// - `None` if the key was not found but no error was encountered.
|
||||
/// - `Err` if an error was encountered while looking for the key.
|
||||
|
|
Loading…
Reference in New Issue