Skip to content

Commit c5a190e

Browse files
authored
Merge pull request #82 from arik-so/2022-10-vec_array_clone_non_primitives
Clone non-primitive types in Vec to array converters.
2 parents deea803 + d486ffe commit c5a190e

16 files changed

+255
-57
lines changed

ci/LDKSwift/Sources/LDKSwift/bindings/Bindings.swift

Lines changed: 211 additions & 31 deletions
Large diffs are not rendered by default.

ci/LDKSwift/Sources/LDKSwift/bindings/structs/ChainMonitor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public init(pointer: LDKChainMonitor, anchor: NativeTypeWrapper){
7373

7474
return Bindings.LDKCVec_BalanceZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChainMonitor>) in
7575
ChainMonitor_get_claimable_balances(this_argPointer, ignored_channelsWrapper.dangle().cOpaqueStruct!)
76-
}, callerContext: "ChainMonitor::get_claimable_balances", deallocate: false)
76+
}, callerContext: "ChainMonitor::get_claimable_balances")
7777

7878
.map { (cOpaqueStruct) in
7979
Balance(pointer: cOpaqueStruct)
@@ -92,7 +92,7 @@ ChainMonitor_get_monitor(this_argPointer, funding_txo.danglingClone().cOpaqueStr
9292

9393
return Bindings.LDKCVec_OutPointZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChainMonitor>) in
9494
ChainMonitor_list_monitors(this_argPointer)
95-
}, callerContext: "ChainMonitor::list_monitors", deallocate: false)
95+
}, callerContext: "ChainMonitor::list_monitors")
9696

9797
.map { (cOpaqueStruct) in
9898
OutPoint(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/ChannelManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ChannelManager_create_channel(this_argPointer, Bindings.new_LDKPublicKey(array:
6666

6767
return Bindings.LDKCVec_ChannelDetailsZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
6868
ChannelManager_list_channels(this_argPointer)
69-
}, callerContext: "ChannelManager::list_channels", deallocate: false)
69+
}, callerContext: "ChannelManager::list_channels")
7070

7171
.map { (cOpaqueStruct) in
7272
ChannelDetails(pointer: cOpaqueStruct)
@@ -78,7 +78,7 @@ ChannelManager_list_channels(this_argPointer)
7878

7979
return Bindings.LDKCVec_ChannelDetailsZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelManager>) in
8080
ChannelManager_list_usable_channels(this_argPointer)
81-
}, callerContext: "ChannelManager::list_usable_channels", deallocate: false)
81+
}, callerContext: "ChannelManager::list_usable_channels")
8282

8383
.map { (cOpaqueStruct) in
8484
ChannelDetails(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/ChannelMonitor.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ChannelMonitor_get_funding_txo(this_argPointer)
8686

8787
return Bindings.LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
8888
ChannelMonitor_get_outputs_to_watch(this_argPointer)
89-
}, callerContext: "ChannelMonitor::get_outputs_to_watch", deallocate: false)
89+
}, callerContext: "ChannelMonitor::get_outputs_to_watch")
9090

9191
.map { (cOpaqueStruct) in
9292
C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(pointer: cOpaqueStruct)
@@ -107,7 +107,7 @@ ChannelMonitor_load_outputs_to_watch(this_argPointer, filterPointer)
107107

108108
return Bindings.LDKCVec_MonitorEventZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
109109
ChannelMonitor_get_and_clear_pending_monitor_events(this_argPointer)
110-
}, callerContext: "ChannelMonitor::get_and_clear_pending_monitor_events", deallocate: false)
110+
}, callerContext: "ChannelMonitor::get_and_clear_pending_monitor_events")
111111

112112
.map { (cOpaqueStruct) in
113113
MonitorEvent(pointer: cOpaqueStruct)
@@ -119,7 +119,7 @@ ChannelMonitor_get_and_clear_pending_monitor_events(this_argPointer)
119119

120120
return Bindings.LDKCVec_EventZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
121121
ChannelMonitor_get_and_clear_pending_events(this_argPointer)
122-
}, callerContext: "ChannelMonitor::get_and_clear_pending_events", deallocate: false)
122+
}, callerContext: "ChannelMonitor::get_and_clear_pending_events")
123123

124124
.map { (cOpaqueStruct) in
125125
Event(pointer: cOpaqueStruct)
@@ -164,7 +164,7 @@ ChannelMonitor_get_latest_holder_commitment_txn(this_argPointer, loggerPointer)
164164
withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
165165
ChannelMonitor_block_connected(this_argPointer, headerPointer, txdataWrapper.dangle().cOpaqueStruct!, height, broadcaster.activate().cOpaqueStruct!, fee_estimator.activate().cOpaqueStruct!, logger.activate().cOpaqueStruct!)
166166
}
167-
}, callerContext: "ChannelMonitor::block_connected", deallocate: false)
167+
}, callerContext: "ChannelMonitor::block_connected")
168168

169169
.map { (cOpaqueStruct) in
170170
TransactionOutputs(pointer: cOpaqueStruct)
@@ -202,7 +202,7 @@ ChannelMonitor_block_disconnected(this_argPointer, headerPointer, height, broadc
202202
withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
203203
ChannelMonitor_transactions_confirmed(this_argPointer, headerPointer, txdataWrapper.dangle().cOpaqueStruct!, height, broadcaster.activate().cOpaqueStruct!, fee_estimator.activate().cOpaqueStruct!, logger.activate().cOpaqueStruct!)
204204
}
205-
}, callerContext: "ChannelMonitor::transactions_confirmed", deallocate: false)
205+
}, callerContext: "ChannelMonitor::transactions_confirmed")
206206

207207
.map { (cOpaqueStruct) in
208208
TransactionOutputs(pointer: cOpaqueStruct)
@@ -225,7 +225,7 @@ ChannelMonitor_transaction_unconfirmed(this_argPointer, txidPointer, broadcaster
225225
withUnsafePointer(to: Bindings.array_to_tuple80(array: header)) { (headerPointer: UnsafePointer<(UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8,UInt8)>) in
226226
ChannelMonitor_best_block_updated(this_argPointer, headerPointer, height, broadcaster.activate().cOpaqueStruct!, fee_estimator.activate().cOpaqueStruct!, logger.activate().cOpaqueStruct!)
227227
}
228-
}, callerContext: "ChannelMonitor::best_block_updated", deallocate: false)
228+
}, callerContext: "ChannelMonitor::best_block_updated")
229229

230230
.map { (cOpaqueStruct) in
231231
TransactionOutputs(pointer: cOpaqueStruct)
@@ -251,7 +251,7 @@ ChannelMonitor_current_best_block(this_argPointer)
251251

252252
return Bindings.LDKCVec_BalanceZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKChannelMonitor>) in
253253
ChannelMonitor_get_claimable_balances(this_argPointer)
254-
}, callerContext: "ChannelMonitor::get_claimable_balances", deallocate: false)
254+
}, callerContext: "ChannelMonitor::get_claimable_balances")
255255

256256
.map { (cOpaqueStruct) in
257257
Balance(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/CommitmentUpdate.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extension Bindings {
9191

9292
return Bindings.LDKCVec_UpdateAddHTLCZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
9393
CommitmentUpdate_get_update_add_htlcs(this_ptrPointer)
94-
}, callerContext: "CommitmentUpdate::get_update_add_htlcs", deallocate: false)
94+
}, callerContext: "CommitmentUpdate::get_update_add_htlcs")
9595

9696
.map { (cOpaqueStruct) in
9797
UpdateAddHTLC(pointer: cOpaqueStruct)
@@ -126,7 +126,7 @@ CommitmentUpdate_get_update_add_htlcs(this_ptrPointer)
126126

127127
return Bindings.LDKCVec_UpdateFulfillHTLCZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
128128
CommitmentUpdate_get_update_fulfill_htlcs(this_ptrPointer)
129-
}, callerContext: "CommitmentUpdate::get_update_fulfill_htlcs", deallocate: false)
129+
}, callerContext: "CommitmentUpdate::get_update_fulfill_htlcs")
130130

131131
.map { (cOpaqueStruct) in
132132
UpdateFulfillHTLC(pointer: cOpaqueStruct)
@@ -161,7 +161,7 @@ CommitmentUpdate_get_update_fulfill_htlcs(this_ptrPointer)
161161

162162
return Bindings.LDKCVec_UpdateFailHTLCZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
163163
CommitmentUpdate_get_update_fail_htlcs(this_ptrPointer)
164-
}, callerContext: "CommitmentUpdate::get_update_fail_htlcs", deallocate: false)
164+
}, callerContext: "CommitmentUpdate::get_update_fail_htlcs")
165165

166166
.map { (cOpaqueStruct) in
167167
UpdateFailHTLC(pointer: cOpaqueStruct)
@@ -196,7 +196,7 @@ CommitmentUpdate_get_update_fail_htlcs(this_ptrPointer)
196196

197197
return Bindings.LDKCVec_UpdateFailMalformedHTLCZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKCommitmentUpdate>) in
198198
CommitmentUpdate_get_update_fail_malformed_htlcs(this_ptrPointer)
199-
}, callerContext: "CommitmentUpdate::get_update_fail_malformed_htlcs", deallocate: false)
199+
}, callerContext: "CommitmentUpdate::get_update_fail_malformed_htlcs")
200200

201201
.map { (cOpaqueStruct) in
202202
UpdateFailMalformedHTLC(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/Invoice.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Invoice_min_final_cltv_expiry(this_argPointer)
162162

163163
return Bindings.LDKCVec_PrivateRouteZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInvoice>) in
164164
Invoice_private_routes(this_argPointer)
165-
}, callerContext: "Invoice::private_routes", deallocate: false)
165+
}, callerContext: "Invoice::private_routes")
166166

167167
.map { (cOpaqueStruct) in
168168
PrivateRoute(pointer: cOpaqueStruct)
@@ -174,7 +174,7 @@ Invoice_private_routes(this_argPointer)
174174

175175
return Bindings.LDKCVec_RouteHintZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKInvoice>) in
176176
Invoice_route_hints(this_argPointer)
177-
}, callerContext: "Invoice::route_hints", deallocate: false)
177+
}, callerContext: "Invoice::route_hints")
178178

179179
.map { (cOpaqueStruct) in
180180
RouteHint(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/NodeAnnouncementInfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ NodeAnnouncementInfo_get_alias(this_ptrPointer)
121121

122122
return Bindings.LDKCVec_NetAddressZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKNodeAnnouncementInfo>) in
123123
NodeAnnouncementInfo_get_addresses(this_ptrPointer)
124-
}, callerContext: "NodeAnnouncementInfo::get_addresses", deallocate: false)
124+
}, callerContext: "NodeAnnouncementInfo::get_addresses")
125125

126126
.map { (cOpaqueStruct) in
127127
NetAddress(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/PaymentParameters.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ PaymentParameters_get_features(this_ptrPointer)
7777

7878
return Bindings.LDKCVec_RouteHintZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKPaymentParameters>) in
7979
PaymentParameters_get_route_hints(this_ptrPointer)
80-
}, callerContext: "PaymentParameters::get_route_hints", deallocate: false)
80+
}, callerContext: "PaymentParameters::get_route_hints")
8181

8282
.map { (cOpaqueStruct) in
8383
RouteHint(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/PhantomRouteHints.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extension Bindings {
6161

6262
return Bindings.LDKCVec_ChannelDetailsZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_ptrPointer: UnsafePointer<LDKPhantomRouteHints>) in
6363
PhantomRouteHints_get_channels(this_ptrPointer)
64-
}, callerContext: "PhantomRouteHints::get_channels", deallocate: false)
64+
}, callerContext: "PhantomRouteHints::get_channels")
6565

6666
.map { (cOpaqueStruct) in
6767
ChannelDetails(pointer: cOpaqueStruct)

ci/LDKSwift/Sources/LDKSwift/bindings/structs/RawInvoice.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ RawInvoice_features(this_argPointer)
146146

147147
return Bindings.LDKCVec_PrivateRouteZ_to_array(nativeType: withUnsafePointer(to: self.cOpaqueStruct!) { (this_argPointer: UnsafePointer<LDKRawInvoice>) in
148148
RawInvoice_private_routes(this_argPointer)
149-
}, callerContext: "RawInvoice::private_routes", deallocate: false)
149+
}, callerContext: "RawInvoice::private_routes")
150150

151151
.map { (cOpaqueStruct) in
152152
PrivateRoute(pointer: cOpaqueStruct)

0 commit comments

Comments
 (0)