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.
2 parents 56970a9 + 7d2faa4 commit 60acb9bCopy full SHA for 60acb9b
crates/core/src/tx_update.rs
@@ -33,6 +33,23 @@ impl<A> Default for TxUpdate<A> {
33
}
34
35
impl<A: Ord> TxUpdate<A> {
36
+ /// Transforms the [`TxUpdate`] to have `anchors` (`A`) of another type (`A2`).
37
+ ///
38
+ /// This takes in a closure with signature `FnMut(A) -> A2` which is called for each anchor to
39
+ /// transform it.
40
+ pub fn map_anchors<A2: Ord, F: FnMut(A) -> A2>(self, mut map: F) -> TxUpdate<A2> {
41
+ TxUpdate {
42
+ txs: self.txs,
43
+ txouts: self.txouts,
44
+ anchors: self
45
+ .anchors
46
+ .into_iter()
47
+ .map(|(a, txid)| (map(a), txid))
48
+ .collect(),
49
+ seen_ats: self.seen_ats,
50
+ }
51
52
+
53
/// Extend this update with `other`.
54
pub fn extend(&mut self, other: TxUpdate<A>) {
55
self.txs.extend(other.txs);
0 commit comments