Skip to content

Commit 446f3ac

Browse files
committed
fixup! Add IntoIterator<Item = &Pk> for Descriptor
1 parent 7e4040d commit 446f3ac

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/descriptor/bare.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ impl<Pk: MiniscriptKey> Bare<Pk> {
6464
}
6565

6666
impl<'a, Pk: MiniscriptKey> IntoIterator for &'a Bare<Pk> {
67-
type Item = &'a Pk;
68-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
67+
type Item = ForEach<'a, Pk>;
68+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
6969

7070
fn into_iter(self) -> Self::IntoIter {
7171
self.ms.into_iter()
@@ -237,11 +237,11 @@ impl<Pk: MiniscriptKey> Pkh<Pk> {
237237
}
238238

239239
impl<'a, Pk: MiniscriptKey> IntoIterator for &'a Pkh<Pk> {
240-
type Item = &'a Pk;
241-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
240+
type Item = ForEach<'a, Pk>;
241+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
242242

243243
fn into_iter(self) -> Self::IntoIter {
244-
Box::new(::std::iter::once(&self.pk))
244+
Box::new(::std::iter::once(ForEach::Key(&self.pk)))
245245
}
246246
}
247247

src/descriptor/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ impl<Pk: MiniscriptKey> Descriptor<Pk> {
301301
}
302302

303303
impl<'a, Pk: MiniscriptKey> IntoIterator for &'a Descriptor<Pk> {
304-
type Item = &'a Pk;
305-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
304+
type Item = ForEach<'a, Pk>;
305+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
306306

307307
fn into_iter(self) -> Self::IntoIter {
308308
match *self {

src/descriptor/segwitv0.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ impl<Pk: MiniscriptKey> Wsh<Pk> {
7979
}
8080

8181
impl<'a, Pk: MiniscriptKey> IntoIterator for &'a Wsh<Pk> {
82-
type Item = &'a Pk;
83-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
82+
type Item = ForEach<'a, Pk>;
83+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
8484

8585
fn into_iter(self) -> Self::IntoIter {
8686
match self.inner {
@@ -328,11 +328,11 @@ impl<Pk: MiniscriptKey> Wpkh<Pk> {
328328
}
329329

330330
impl<'a, Pk: MiniscriptKey> IntoIterator for &'a Wpkh<Pk> {
331-
type Item = &'a Pk;
332-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
331+
type Item = ForEach<'a, Pk>;
332+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
333333

334334
fn into_iter(self) -> Self::IntoIter {
335-
Box::new(::std::iter::once(&self.pk))
335+
Box::new(::std::iter::once(ForEach::Key(&self.pk)))
336336
}
337337
}
338338

src/descriptor/sh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ impl<Pk: MiniscriptKey> Sh<Pk> {
194194
}
195195

196196
impl<'a, Pk: MiniscriptKey> IntoIterator for &'a Sh<Pk> {
197-
type Item = &'a Pk;
198-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
197+
type Item = ForEach<'a, Pk>;
198+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
199199

200200
fn into_iter(self) -> Self::IntoIter {
201201
match self.inner {

src/descriptor/sortedmulti.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx> {
107107
}
108108

109109
impl<'a, Pk: MiniscriptKey, Ctx: ScriptContext> IntoIterator for &'a SortedMultiVec<Pk, Ctx> {
110-
type Item = &'a Pk;
111-
type IntoIter = Box<dyn Iterator<Item = &'a Pk> + 'a>;
110+
type Item = ForEach<'a, Pk>;
111+
type IntoIter = Box<dyn Iterator<Item = ForEach<'a, Pk>> + 'a>;
112112

113113
fn into_iter(self) -> Self::IntoIter {
114-
Box::new(self.pks.iter())
114+
Box::new(self.pks.iter().map(|pk| ForEach::Key(pk)))
115115
}
116116
}
117117

0 commit comments

Comments
 (0)