Standardize function doc Errors
Changed the function docs to have the same format of /// /// # Errors /// /// description
This commit is contained in:
parent
d219ceb68e
commit
df83016c98
|
@ -207,7 +207,7 @@ mod primitive {
|
|||
|
||||
/// Try pushing a single byte.
|
||||
///
|
||||
/// ## Errors
|
||||
/// # Errors
|
||||
///
|
||||
/// This method fails if `self` would exceed the limit.
|
||||
#[allow(deprecated)]
|
||||
|
@ -220,7 +220,7 @@ mod primitive {
|
|||
|
||||
/// Try appending a slice to `PushBytesBuf`
|
||||
///
|
||||
/// ## Errors
|
||||
/// # Errors
|
||||
///
|
||||
/// This method fails if `self` would exceed the limit.
|
||||
pub fn extend_from_slice(&mut self, bytes: &[u8]) -> Result<(), PushBytesError> {
|
||||
|
|
|
@ -67,7 +67,7 @@ impl Psbt {
|
|||
/// For each PSBT input that contains UTXO information `Ok` is returned containing that information.
|
||||
/// The order of returned items is same as the order of inputs.
|
||||
///
|
||||
/// ## Errors
|
||||
/// # Errors
|
||||
///
|
||||
/// The function returns error when UTXO information is not present or is invalid.
|
||||
///
|
||||
|
@ -140,7 +140,7 @@ impl Psbt {
|
|||
|
||||
/// Extracts the [`Transaction`] from a [`Psbt`] by filling in the available signature information.
|
||||
///
|
||||
/// ## Errors
|
||||
/// # Errors
|
||||
///
|
||||
/// [`ExtractTxError`] variants will contain either the [`Psbt`] itself or the [`Transaction`]
|
||||
/// that was extracted. These can be extracted from the Errors in order to recover.
|
||||
|
@ -151,7 +151,7 @@ impl Psbt {
|
|||
|
||||
/// Extracts the [`Transaction`] from a [`Psbt`] by filling in the available signature information.
|
||||
///
|
||||
/// ## Errors
|
||||
/// # Errors
|
||||
///
|
||||
/// See [`extract_tx`].
|
||||
///
|
||||
|
@ -703,7 +703,7 @@ impl Psbt {
|
|||
/// 'Fee' being the amount that will be paid for mining a transaction with the current inputs
|
||||
/// and outputs i.e., the difference in value of the total inputs and the total outputs.
|
||||
///
|
||||
/// ## Errors
|
||||
/// # Errors
|
||||
///
|
||||
/// - [`Error::MissingUtxo`] when UTXO information for any input is not present or is invalid.
|
||||
/// - [`Error::NegativeFee`] if calculated value is negative.
|
||||
|
|
|
@ -188,6 +188,7 @@ where
|
|||
/// Constructs a [`ProprietaryKey`] from a [`Key`].
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns [`Error::InvalidProprietaryKey`] if `key` does not start with `0xFC` byte.
|
||||
fn try_from(key: Key) -> Result<Self, Self::Error> {
|
||||
if key.type_value != 0xFC {
|
||||
|
|
|
@ -66,6 +66,7 @@ impl TaprootMerkleBranch {
|
|||
/// Creates a merkle proof from list of hashes.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// If inner proof length is more than [`TAPROOT_CONTROL_MAX_NODE_COUNT`] (128).
|
||||
#[inline]
|
||||
fn from_collection<T: AsRef<[TapNodeHash]> + Into<Vec<TapNodeHash>>>(
|
||||
|
@ -123,6 +124,7 @@ macro_rules! impl_try_from {
|
|||
/// Creates a merkle proof from list of hashes.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// If inner proof length is more than [`TAPROOT_CONTROL_MAX_NODE_COUNT`] (128).
|
||||
#[inline]
|
||||
fn try_from(v: $from) -> Result<Self, Self::Error> {
|
||||
|
|
|
@ -429,8 +429,13 @@ impl TaprootBuilder {
|
|||
Ok(TaprootBuilder { branch: vec![Some(node)] })
|
||||
}
|
||||
|
||||
/// Adds a leaf script at `depth` to the builder with script version `ver`. Errors if the leaves
|
||||
/// are not provided in DFS walk order. The depth of the root node is 0.
|
||||
/// Adds a leaf script at `depth` to the builder with script version `ver`.
|
||||
///
|
||||
/// The depth of the root node is 0.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Errors if the leaves are not provided in DFS walk order.
|
||||
pub fn add_leaf_with_ver(
|
||||
self,
|
||||
depth: u8,
|
||||
|
@ -441,16 +446,26 @@ impl TaprootBuilder {
|
|||
self.insert(leaf, depth)
|
||||
}
|
||||
|
||||
/// Adds a leaf script at `depth` to the builder with default script version. Errors if the
|
||||
/// leaves are not provided in DFS walk order. The depth of the root node is 0.
|
||||
/// Adds a leaf script at `depth` to the builder with default script version.
|
||||
///
|
||||
/// The depth of the root node is 0.
|
||||
///
|
||||
/// See [`TaprootBuilder::add_leaf_with_ver`] for adding a leaf with specific version.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Errors if the leaves are not provided in DFS walk order.
|
||||
pub fn add_leaf(self, depth: u8, script: ScriptBuf) -> Result<Self, TaprootBuilderError> {
|
||||
self.add_leaf_with_ver(depth, script, LeafVersion::TapScript)
|
||||
}
|
||||
|
||||
/// Adds a hidden/omitted node at `depth` to the builder. Errors if the leaves are not provided
|
||||
/// in DFS walk order. The depth of the root node is 0.
|
||||
/// Adds a hidden/omitted node at `depth` to the builder.
|
||||
///
|
||||
/// The depth of the root node is 0.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Errors if the leaves are not provided in DFS walk order.
|
||||
pub fn add_hidden_node(
|
||||
self,
|
||||
depth: u8,
|
||||
|
|
Loading…
Reference in New Issue