Skip to content

Commit 7e4040d

Browse files
committed
fixup! Add IntoIterator<Item = &Pk> for Miniscript
1 parent c24f792 commit 7e4040d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/miniscript/astelem.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -817,17 +817,17 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
817817
}
818818

819819
impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> IntoIterator for &'a Terminal<Pk, Ctx> {
820-
type Item = &'a Pk;
821-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
820+
type Item = ForEach<'a, Pk>;
821+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
822822

823823
fn into_iter(self) -> Self::IntoIter {
824824
use std::iter;
825825

826826
match self {
827-
Terminal::PkK(ref pk) => Box::new(iter::once(pk)),
827+
Terminal::PkK(ref pk) => Box::new(iter::once(ForEach::Key(pk))),
828+
Terminal::PkH(ref pkh) => Box::new(iter::once(ForEach::Hash(pkh))),
828829
Terminal::True
829830
| Terminal::False
830-
| Terminal::PkH(_)
831831
| Terminal::After(_)
832832
| Terminal::Older(_)
833833
| Terminal::Sha256(_)
@@ -853,7 +853,7 @@ impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> IntoIterator for &'a Terminal<Pk
853853
Terminal::Thresh(_, ref scripts) => {
854854
Box::new(scripts.iter().map(|s| s.into_iter()).flatten())
855855
}
856-
Terminal::Multi(_, ref pks) => Box::new(pks.iter()),
856+
Terminal::Multi(_, ref pks) => Box::new(pks.iter().map(|pk| ForEach::Key(pk))),
857857
}
858858
}
859859
}

src/miniscript/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ where
414414
}
415415

416416
impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> IntoIterator for &'a Miniscript<Pk, Ctx> {
417-
type Item = &'a Pk;
418-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
417+
type Item = ForEach<'a, Pk>;
418+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
419419

420420
fn into_iter(self) -> Self::IntoIter {
421421
self.node.into_iter()

0 commit comments

Comments
 (0)