Removed IntoIterator for TapTree implementation
In the future, TapTree may iterate over different node types, and that's why it does not have `iter()` function; using instead `script_leafs`. Thus, we should not have IntoIterator implementation as well
This commit is contained in:
parent
7a5482d23a
commit
3c59897598
|
@ -158,7 +158,15 @@ impl TapTree {
|
||||||
/// Returns [`TapTreeIter`] iterator for a taproot script tree, operating in DFS order over
|
/// Returns [`TapTreeIter`] iterator for a taproot script tree, operating in DFS order over
|
||||||
/// tree [`ScriptLeaf`]s.
|
/// tree [`ScriptLeaf`]s.
|
||||||
pub fn script_leaves(&self) -> TapTreeIter {
|
pub fn script_leaves(&self) -> TapTreeIter {
|
||||||
self.into_iter()
|
match (self.0.branch().len(), self.0.branch().last()) {
|
||||||
|
(1, Some(Some(root))) => {
|
||||||
|
TapTreeIter {
|
||||||
|
leaf_iter: root.leaves.iter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// This should be unreachable as we Taptree is already finalized
|
||||||
|
_ => unreachable!("non-finalized tree builder inside TapTree"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,23 +185,6 @@ impl<'tree> Iterator for TapTreeIter<'tree> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tree> IntoIterator for &'tree TapTree {
|
|
||||||
type Item = &'tree ScriptLeaf;
|
|
||||||
type IntoIter = TapTreeIter<'tree>;
|
|
||||||
|
|
||||||
fn into_iter(self) -> Self::IntoIter {
|
|
||||||
match (self.0.branch().len(), self.0.branch().last()) {
|
|
||||||
(1, Some(Some(root))) => {
|
|
||||||
TapTreeIter {
|
|
||||||
leaf_iter: root.leaves.iter()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// This should be unreachable as we Taptree is already finalized
|
|
||||||
_ => unreachable!("non-finalized tree builder inside TapTree"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Output {
|
impl Output {
|
||||||
pub(super) fn insert_pair(&mut self, pair: raw::Pair) -> Result<(), encode::Error> {
|
pub(super) fn insert_pair(&mut self, pair: raw::Pair) -> Result<(), encode::Error> {
|
||||||
let raw::Pair {
|
let raw::Pair {
|
||||||
|
|
Loading…
Reference in New Issue