Struct elements_miniscript::descriptor::DescriptorXKey  
source · pub struct DescriptorXKey<K: InnerXKey> {
    pub origin: Option<(Fingerprint, DerivationPath)>,
    pub xkey: K,
    pub derivation_path: DerivationPath,
    pub wildcard: Wildcard,
}Expand description
An extended key with origin, derivation path, and wildcard.
Fields§
§origin: Option<(Fingerprint, DerivationPath)>Origin information
xkey: KThe extended key
derivation_path: DerivationPathThe derivation path
wildcard: WildcardWhether the descriptor is wildcard
Implementations§
source§impl<K: InnerXKey> DescriptorXKey<K>
 
impl<K: InnerXKey> DescriptorXKey<K>
sourcepub fn matches<C: Signing>(
    &self,
    keysource: &KeySource,
    secp: &Secp256k1<C>
) -> Option<DerivationPath>
 
pub fn matches<C: Signing>( &self, keysource: &KeySource, secp: &Secp256k1<C> ) -> Option<DerivationPath>
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 miniscript::bitcoin::bip32;
use miniscript::descriptor::DescriptorPublicKey;
let ctx = miniscript::elements::secp256k1_zkp::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);Trait Implementations§
source§impl<K: Clone + InnerXKey> Clone for DescriptorXKey<K>
 
impl<K: Clone + InnerXKey> Clone for DescriptorXKey<K>
source§fn clone(&self) -> DescriptorXKey<K>
 
fn clone(&self) -> DescriptorXKey<K>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moresource§impl<K: Ord + InnerXKey> Ord for DescriptorXKey<K>
 
impl<K: Ord + InnerXKey> Ord for DescriptorXKey<K>
source§fn cmp(&self, other: &DescriptorXKey<K>) -> Ordering
 
fn cmp(&self, other: &DescriptorXKey<K>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<K: PartialEq + InnerXKey> PartialEq<DescriptorXKey<K>> for DescriptorXKey<K>
 
impl<K: PartialEq + InnerXKey> PartialEq<DescriptorXKey<K>> for DescriptorXKey<K>
source§fn eq(&self, other: &DescriptorXKey<K>) -> bool
 
fn eq(&self, other: &DescriptorXKey<K>) -> bool
This method tests for 
self and other values to be equal, and is used
by ==.source§impl<K: PartialOrd + InnerXKey> PartialOrd<DescriptorXKey<K>> for DescriptorXKey<K>
 
impl<K: PartialOrd + InnerXKey> PartialOrd<DescriptorXKey<K>> for DescriptorXKey<K>
source§fn partial_cmp(&self, other: &DescriptorXKey<K>) -> Option<Ordering>
 
fn partial_cmp(&self, other: &DescriptorXKey<K>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
 
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for 
self and other) and is used by the <=
operator. Read moreimpl<K: Eq + InnerXKey> Eq for DescriptorXKey<K>
impl<K: InnerXKey> StructuralEq for DescriptorXKey<K>
impl<K: InnerXKey> StructuralPartialEq for DescriptorXKey<K>
Auto Trait Implementations§
impl<K> RefUnwindSafe for DescriptorXKey<K>where K: RefUnwindSafe,
impl<K> Send for DescriptorXKey<K>where K: Send,
impl<K> Sync for DescriptorXKey<K>where K: Sync,
impl<K> Unpin for DescriptorXKey<K>where K: Unpin,
impl<K> UnwindSafe for DescriptorXKey<K>where K: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more