Use impl syntax instead of generic

A single trait bound can be expressed using the `impl` style. This is a
breaking change because callers can no longer use turbofish. In this
case that probably does not matter because users are likely just passing
an integer in and letting the compiler infer the type.

Done in preparation for moving logic into an extension trait so that the
functions can be parsed by the `define_extension_trait` macro.

ref: https://doc.rust-lang.org/reference/types/impl-trait.html
This commit is contained in:
Tobin C. Harding 2024-07-23 06:23:11 -05:00
parent 1fbc653822
commit c1aa33ed89
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -146,12 +146,12 @@ impl Script {
/// * `flags` - Verification flags, see [`bitcoinconsensus::VERIFY_ALL_PRE_TAPROOT`] and similar. /// * `flags` - Verification flags, see [`bitcoinconsensus::VERIFY_ALL_PRE_TAPROOT`] and similar.
/// ///
/// [`bitcoinconsensus::VERIFY_ALL_PRE_TAPROOT`]: https://docs.rs/bitcoinconsensus/0.106.0+26.0/bitcoinconsensus/constant.VERIFY_ALL_PRE_TAPROOT.html /// [`bitcoinconsensus::VERIFY_ALL_PRE_TAPROOT`]: https://docs.rs/bitcoinconsensus/0.106.0+26.0/bitcoinconsensus/constant.VERIFY_ALL_PRE_TAPROOT.html
pub fn verify_with_flags<F: Into<u32>>( pub fn verify_with_flags(
&self, &self,
index: usize, index: usize,
amount: crate::Amount, amount: crate::Amount,
spending_tx: &[u8], spending_tx: &[u8],
flags: F, flags: impl Into<u32>,
) -> Result<(), BitcoinconsensusError> { ) -> Result<(), BitcoinconsensusError> {
verify_script_with_flags(self, index, amount, spending_tx, flags) verify_script_with_flags(self, index, amount, spending_tx, flags)
} }