We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ForEach::as_key()
PkPkh
1 parent de74dc0 commit 9570d49Copy full SHA for 9570d49
src/miniscript/iter.rs
@@ -368,6 +368,16 @@ pub enum PkPkh<Pk: MiniscriptKey> {
368
HashedPubkey(Pk::Hash),
369
}
370
371
+impl<Pk: MiniscriptKey<Hash = Pk>> PkPkh<Pk> {
372
+ /// Convenience method to avoid distinguishing between keys and hashes when these are the same type
373
+ pub fn as_key(self) -> Pk {
374
+ match self {
375
+ PkPkh::PlainPubkey(pk) => pk,
376
+ PkPkh::HashedPubkey(pkh) => pkh,
377
+ }
378
379
+}
380
+
381
/// Iterator for traversing all [MiniscriptKey]'s and hashes, depending what data are present in AST,
382
/// starting from some specific node which constructs the iterator via
383
/// [Miniscript::iter_pk_pkh] method.
0 commit comments