Skip to content

Commit 2284858

Browse files
committed
tr: add into_control_block accessor to TrSpendInfoIterItem
1 parent ea636ff commit 2284858

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/descriptor/tr/spend_info.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,19 @@ impl<'sp, Pk: MiniscriptKey> TrSpendInfoIterItem<'sp, Pk> {
339339
/// The control block of this leaf.
340340
///
341341
/// Unlike the other data obtainable from [`TrSpendInfoIterItem`], this one is computed
342-
/// dynamically during iteration and therefore will not outlive the iterator item. If
343-
/// you need access to multiple control blocks at once, will likely need to clone and
344-
/// store them separately.
342+
/// dynamically during iteration and therefore will not outlive the iterator item. See
343+
/// [`Self::into_control_block`], which consumes the iterator item but will give you an
344+
/// owned copy of the control block.
345+
///
346+
/// If you need access to multiple control blocks at once, you may need to `clone` the
347+
/// return value of this method, or call [`Self::into_control_block`], and store the
348+
/// result in a separate container.
345349
#[inline]
346350
pub fn control_block(&self) -> &ControlBlock { &self.control_block }
351+
352+
/// Extract the control block of this leaf, consuming `self`.
353+
#[inline]
354+
pub fn into_control_block(self) -> ControlBlock { self.control_block }
347355
}
348356

349357
#[cfg(test)]

0 commit comments

Comments
 (0)