psbt: documentation examples for PsbtSighashType

This commit is contained in:
Jose Storopoli 2024-05-11 15:27:33 +00:00
parent 0d627326ce
commit 4f0eafa2b1
No known key found for this signature in database
GPG Key ID: 01BE853A206518CC
1 changed files with 10 additions and 0 deletions

View File

@ -136,6 +136,16 @@ pub struct Input {
/// type can be either [`EcdsaSighashType`] or [`TapSighashType`] but it is not possible to know
/// directly which signature hash type the user is dealing with. Therefore, the user is responsible
/// for converting to/from [`PsbtSighashType`] from/to the desired signature hash type they need.
///
/// # Examples
///
/// ```
/// use bitcoin::{EcdsaSighashType, TapSighashType};
/// use bitcoin::psbt::PsbtSighashType;
///
/// let ecdsa_sighash_all: PsbtSighashType = EcdsaSighashType::All.into();
/// let tap_sighash_all: PsbtSighashType = TapSighashType::All.into();
/// ```
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]