pub fn matches<C: Signing>(
        &self,
        keysource: &bip32::KeySource,
        secp: &Secp256k1<C>,
    ) -> Option<bip32::DerivationPath> {
        let (fingerprint, path) = keysource;

        let (compare_fingerprint, compare_path) = match self.origin {
            Some((fingerprint, ref path)) => (
                fingerprint,
                path.into_iter()
                    .chain(self.derivation_path.into_iter())
                    .collect(),
            ),
            None => (
                self.xkey.xkey_fingerprint(secp),
                self.derivation_path.into_iter().collect::<Vec<_>>(),
            ),
        };

        let path_excluding_wildcard = if self.wildcard != Wildcard::None && !path.is_empty() {
            path.into_iter()
                .take(path.as_ref().len() - 1)
                .cloned()
                .collect()
        } else {
            path.clone()
        };

        if &compare_fingerprint == fingerprint
            && compare_path
                .into_iter()
                .eq(path_excluding_wildcard.into_iter())
        {
            Some(path_excluding_wildcard)
        } else {
            None
        }
    }
/// Compares this key with a `keysource` and returns the matching derivation path, if any.
///
/// For keys that have an origin, the `keysource`'s fingerprint will be compared
/// with the origin's fingerprint, and the `keysource`'s path will be compared with the concatenation of the
/// origin's and key's paths.
///
/// If the key `wildcard`, the last item of the `keysource`'s path will be ignored,
///
/// ## Examples
///
/// ```
/// # use std::str::FromStr;
/// # fn body() -> Result<(), Box<dyn std::error::Error>> {
/// use miniscript::bitcoin::util::bip32;
/// use miniscript::descriptor::DescriptorPublicKey;
///
/// let ctx = miniscript::bitcoin::secp256k1::Secp256k1::signing_only();
///
/// let key = DescriptorPublicKey::from_str("[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/1/*")?;
/// let xpub = match key {
///     DescriptorPublicKey::XPub(xpub) => xpub,
///     _ => panic!("Parsing Error"),
/// };
///
/// assert_eq!(xpub.matches(&(bip32::Fingerprint::from_str("d34db33f")?, bip32::DerivationPath::from_str("m/44'/0'/0'/1/42")?), &ctx), Some(bip32::DerivationPath::from_str("m/44'/0'/0'/1")?));
/// assert_eq!(xpub.matches(&(bip32::Fingerprint::from_str("ffffffff")?, bip32::DerivationPath::from_str("m/44'/0'/0'/1/42")?), &ctx), None);
/// assert_eq!(xpub.matches(&(bip32::Fingerprint::from_str("d34db33f")?, bip32::DerivationPath::from_str("m/44'/0'/0'/100/0")?), &ctx), None);
/// # Ok(())
/// # }
/// # body().unwrap()
/// ```
Compares this key with a `keysource` and returns the matching derivation path, if any.

If the key `wildcard`, the last item of the `keysource`'s path will be ignored.
Compares this key with a ` keysource ` and returns the matching derivation path if any . If the key ` wildcard ` the last item of the ` keysource ` ' s path will be ignored .
pub fn matches<C: Signing>(
        &self,
        keysource: &bip32::KeySource,
        secp: &Secp256k1<C>,
    ) -> Option<bip32::DerivationPath> {
        let (fingerprint, path) = keysource;
        let (compare_fingerprint, compare_path) = match self.origin {
            Some((fingerprint, ref path)) => (
                fingerprint,
                path.into_iter()
                    .chain(self.derivation_path.into_iter())
                    .collect(),
            ),
            None => (
                self.xkey.xkey_fingerprint(secp),
                self.derivation_path.into_iter().collect::<Vec<_>>(),
            ),
        };
        let path_excluding_wildcard = if self.wildcard != Wildcard::None && !path.is_empty() {
            path.into_iter()
                .take(path.as_ref().len() - 1)
                .cloned()
                .collect()
        } else {
            path.clone()
        };
        if &compare_fingerprint == fingerprint
            && compare_path
                .into_iter()
                .eq(path_excluding_wildcard.into_iter())
        {
            Some(path_excluding_wildcard)
        } else {
            None
        }
    }
pub fn matches < C : Signing > ( & self , keysource : & bip32 :: KeySource , secp : & Secp256k1 < C > , ) -> Option < bip32 :: DerivationPath > { let ( fingerprint , path ) = keysource ; let ( compare_fingerprint , compare_path ) = match self . origin { Some ( ( fingerprint , ref path ) ) => ( fingerprint , path . into_iter ( ) . chain ( self . derivation_path . into_iter ( ) ) . collect ( ) , ) , None => ( self . xkey . xkey_fingerprint ( secp ) , self . derivation_path . into_iter ( ) . collect :: < Vec < _ > > ( ) , ) , } ; let path_excluding_wildcard = if self . wildcard != Wildcard :: None && ! path . is_empty ( ) { path . into_iter ( ) . take ( path . as_ref ( ) . len ( ) - 1 ) . cloned ( ) . collect ( ) } else { path . clone ( ) } ; if & compare_fingerprint == fingerprint && compare_path . into_iter ( ) . eq ( path_excluding_wildcard . into_iter ( ) ) { Some ( path_excluding_wildcard ) } else { None } }
Compares this key with a `keysource` and returns the matching derivation path, if any.
Compares this key with a ` keysource ` and returns the matching derivation path if any .
&self
keysource
&bip32::KeySource
secp
&Secp256k1<C>
&self
keysource
&bip32::KeySource
secp
&Secp256k1<C>
examples
None
use std::str::fromstr;
None
fn body() -> result<(), box<dyn std::error::error>> {
use miniscript::bitcoin::util::bip32;
use miniscript::descriptor::DescriptorPublicKey.

let ctx = miniscript::bitcoin::secp256k1::Secp256k1::signing_only().

let key = DescriptorPublicKey::from_str("[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/1")?;
let xpub = match key {
DescriptorPublicKey::XPub(xpub) => xpub,
_ => panic!("Parsing Error"),
}.


use miniscript :: bitcoin :: util :: bip32 ; use miniscript :: descriptor :: DescriptorPublicKey . let ctx = miniscript :: bitcoin :: secp256k1 :: Secp256k1 :: signing_only () . let key = DescriptorPublicKey :: from_str ( " [ d34db33f / 44 ' / 0 ' / 0 ' ] xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL / 1 " ) ? ; let xpub = match key { DescriptorPublicKey :: XPub ( xpub ) = > xpub _ = > panic! ( " Parsing Error " ) } .
ok(())
None
}
None
body().unwrap()
None