b97dcc899ddc46fa13076c87dedbc10dbee4cec2
[rust-lightning] / lightning-c-bindings / src / c_types / derived.rs
1 #[repr(C)]
2 pub union CResult_SecretKeyErrorZPtr {
3         pub result: *mut crate::c_types::SecretKey,
4         pub err: *mut crate::c_types::Secp256k1Error,
5 }
6 #[repr(C)]
7 pub struct CResult_SecretKeyErrorZ {
8         pub contents: CResult_SecretKeyErrorZPtr,
9         pub result_ok: bool,
10 }
11 #[no_mangle]
12 pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ {
13         CResult_SecretKeyErrorZ {
14                 contents: CResult_SecretKeyErrorZPtr {
15                         result: Box::into_raw(Box::new(o)),
16                 },
17                 result_ok: true,
18         }
19 }
20 #[no_mangle]
21 pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ {
22         CResult_SecretKeyErrorZ {
23                 contents: CResult_SecretKeyErrorZPtr {
24                         err: Box::into_raw(Box::new(e)),
25                 },
26                 result_ok: false,
27         }
28 }
29 #[no_mangle]
30 pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { }
31 impl Drop for CResult_SecretKeyErrorZ {
32         fn drop(&mut self) {
33                 if self.result_ok {
34                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
35                                 let _ = unsafe { Box::from_raw(self.contents.result) };
36                         }
37                 } else {
38                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
39                                 let _ = unsafe { Box::from_raw(self.contents.err) };
40                         }
41                 }
42         }
43 }
44 impl From<crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>> for CResult_SecretKeyErrorZ {
45         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::SecretKey, crate::c_types::Secp256k1Error>) -> Self {
46                 let contents = if o.result_ok {
47                         let result = unsafe { o.contents.result };
48                         unsafe { o.contents.result = std::ptr::null_mut() };
49                         CResult_SecretKeyErrorZPtr { result }
50                 } else {
51                         let err = unsafe { o.contents.err };
52                         unsafe { o.contents.err = std::ptr::null_mut(); }
53                         CResult_SecretKeyErrorZPtr { err }
54                 };
55                 Self {
56                         contents,
57                         result_ok: o.result_ok,
58                 }
59         }
60 }
61 #[repr(C)]
62 pub union CResult_PublicKeyErrorZPtr {
63         pub result: *mut crate::c_types::PublicKey,
64         pub err: *mut crate::c_types::Secp256k1Error,
65 }
66 #[repr(C)]
67 pub struct CResult_PublicKeyErrorZ {
68         pub contents: CResult_PublicKeyErrorZPtr,
69         pub result_ok: bool,
70 }
71 #[no_mangle]
72 pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ {
73         CResult_PublicKeyErrorZ {
74                 contents: CResult_PublicKeyErrorZPtr {
75                         result: Box::into_raw(Box::new(o)),
76                 },
77                 result_ok: true,
78         }
79 }
80 #[no_mangle]
81 pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ {
82         CResult_PublicKeyErrorZ {
83                 contents: CResult_PublicKeyErrorZPtr {
84                         err: Box::into_raw(Box::new(e)),
85                 },
86                 result_ok: false,
87         }
88 }
89 #[no_mangle]
90 pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { }
91 impl Drop for CResult_PublicKeyErrorZ {
92         fn drop(&mut self) {
93                 if self.result_ok {
94                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
95                                 let _ = unsafe { Box::from_raw(self.contents.result) };
96                         }
97                 } else {
98                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
99                                 let _ = unsafe { Box::from_raw(self.contents.err) };
100                         }
101                 }
102         }
103 }
104 impl From<crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>> for CResult_PublicKeyErrorZ {
105         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::PublicKey, crate::c_types::Secp256k1Error>) -> Self {
106                 let contents = if o.result_ok {
107                         let result = unsafe { o.contents.result };
108                         unsafe { o.contents.result = std::ptr::null_mut() };
109                         CResult_PublicKeyErrorZPtr { result }
110                 } else {
111                         let err = unsafe { o.contents.err };
112                         unsafe { o.contents.err = std::ptr::null_mut(); }
113                         CResult_PublicKeyErrorZPtr { err }
114                 };
115                 Self {
116                         contents,
117                         result_ok: o.result_ok,
118                 }
119         }
120 }
121 #[repr(C)]
122 pub union CResult_TxCreationKeysDecodeErrorZPtr {
123         pub result: *mut crate::ln::chan_utils::TxCreationKeys,
124         pub err: *mut crate::ln::msgs::DecodeError,
125 }
126 #[repr(C)]
127 pub struct CResult_TxCreationKeysDecodeErrorZ {
128         pub contents: CResult_TxCreationKeysDecodeErrorZPtr,
129         pub result_ok: bool,
130 }
131 #[no_mangle]
132 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ {
133         CResult_TxCreationKeysDecodeErrorZ {
134                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
135                         result: Box::into_raw(Box::new(o)),
136                 },
137                 result_ok: true,
138         }
139 }
140 #[no_mangle]
141 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ {
142         CResult_TxCreationKeysDecodeErrorZ {
143                 contents: CResult_TxCreationKeysDecodeErrorZPtr {
144                         err: Box::into_raw(Box::new(e)),
145                 },
146                 result_ok: false,
147         }
148 }
149 #[no_mangle]
150 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { }
151 impl Drop for CResult_TxCreationKeysDecodeErrorZ {
152         fn drop(&mut self) {
153                 if self.result_ok {
154                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
155                                 let _ = unsafe { Box::from_raw(self.contents.result) };
156                         }
157                 } else {
158                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
159                                 let _ = unsafe { Box::from_raw(self.contents.err) };
160                         }
161                 }
162         }
163 }
164 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::ln::msgs::DecodeError>> for CResult_TxCreationKeysDecodeErrorZ {
165         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::ln::msgs::DecodeError>) -> Self {
166                 let contents = if o.result_ok {
167                         let result = unsafe { o.contents.result };
168                         unsafe { o.contents.result = std::ptr::null_mut() };
169                         CResult_TxCreationKeysDecodeErrorZPtr { result }
170                 } else {
171                         let err = unsafe { o.contents.err };
172                         unsafe { o.contents.err = std::ptr::null_mut(); }
173                         CResult_TxCreationKeysDecodeErrorZPtr { err }
174                 };
175                 Self {
176                         contents,
177                         result_ok: o.result_ok,
178                 }
179         }
180 }
181 impl Clone for CResult_TxCreationKeysDecodeErrorZ {
182         fn clone(&self) -> Self {
183                 if self.result_ok {
184                         Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr {
185                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::TxCreationKeys>::clone(unsafe { &*self.contents.result })))
186                         } }
187                 } else {
188                         Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr {
189                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
190                         } }
191                 }
192         }
193 }
194 #[no_mangle]
195 pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { orig.clone() }
196 #[repr(C)]
197 pub union CResult_ChannelPublicKeysDecodeErrorZPtr {
198         pub result: *mut crate::ln::chan_utils::ChannelPublicKeys,
199         pub err: *mut crate::ln::msgs::DecodeError,
200 }
201 #[repr(C)]
202 pub struct CResult_ChannelPublicKeysDecodeErrorZ {
203         pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr,
204         pub result_ok: bool,
205 }
206 #[no_mangle]
207 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ {
208         CResult_ChannelPublicKeysDecodeErrorZ {
209                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
210                         result: Box::into_raw(Box::new(o)),
211                 },
212                 result_ok: true,
213         }
214 }
215 #[no_mangle]
216 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ {
217         CResult_ChannelPublicKeysDecodeErrorZ {
218                 contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
219                         err: Box::into_raw(Box::new(e)),
220                 },
221                 result_ok: false,
222         }
223 }
224 #[no_mangle]
225 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { }
226 impl Drop for CResult_ChannelPublicKeysDecodeErrorZ {
227         fn drop(&mut self) {
228                 if self.result_ok {
229                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
230                                 let _ = unsafe { Box::from_raw(self.contents.result) };
231                         }
232                 } else {
233                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
234                                 let _ = unsafe { Box::from_raw(self.contents.err) };
235                         }
236                 }
237         }
238 }
239 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelPublicKeys, crate::ln::msgs::DecodeError>> for CResult_ChannelPublicKeysDecodeErrorZ {
240         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelPublicKeys, crate::ln::msgs::DecodeError>) -> Self {
241                 let contents = if o.result_ok {
242                         let result = unsafe { o.contents.result };
243                         unsafe { o.contents.result = std::ptr::null_mut() };
244                         CResult_ChannelPublicKeysDecodeErrorZPtr { result }
245                 } else {
246                         let err = unsafe { o.contents.err };
247                         unsafe { o.contents.err = std::ptr::null_mut(); }
248                         CResult_ChannelPublicKeysDecodeErrorZPtr { err }
249                 };
250                 Self {
251                         contents,
252                         result_ok: o.result_ok,
253                 }
254         }
255 }
256 impl Clone for CResult_ChannelPublicKeysDecodeErrorZ {
257         fn clone(&self) -> Self {
258                 if self.result_ok {
259                         Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
260                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::ChannelPublicKeys>::clone(unsafe { &*self.contents.result })))
261                         } }
262                 } else {
263                         Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr {
264                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
265                         } }
266                 }
267         }
268 }
269 #[no_mangle]
270 pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { orig.clone() }
271 #[repr(C)]
272 pub union CResult_TxCreationKeysErrorZPtr {
273         pub result: *mut crate::ln::chan_utils::TxCreationKeys,
274         pub err: *mut crate::c_types::Secp256k1Error,
275 }
276 #[repr(C)]
277 pub struct CResult_TxCreationKeysErrorZ {
278         pub contents: CResult_TxCreationKeysErrorZPtr,
279         pub result_ok: bool,
280 }
281 #[no_mangle]
282 pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ {
283         CResult_TxCreationKeysErrorZ {
284                 contents: CResult_TxCreationKeysErrorZPtr {
285                         result: Box::into_raw(Box::new(o)),
286                 },
287                 result_ok: true,
288         }
289 }
290 #[no_mangle]
291 pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ {
292         CResult_TxCreationKeysErrorZ {
293                 contents: CResult_TxCreationKeysErrorZPtr {
294                         err: Box::into_raw(Box::new(e)),
295                 },
296                 result_ok: false,
297         }
298 }
299 #[no_mangle]
300 pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { }
301 impl Drop for CResult_TxCreationKeysErrorZ {
302         fn drop(&mut self) {
303                 if self.result_ok {
304                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
305                                 let _ = unsafe { Box::from_raw(self.contents.result) };
306                         }
307                 } else {
308                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
309                                 let _ = unsafe { Box::from_raw(self.contents.err) };
310                         }
311                 }
312         }
313 }
314 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>> for CResult_TxCreationKeysErrorZ {
315         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TxCreationKeys, crate::c_types::Secp256k1Error>) -> Self {
316                 let contents = if o.result_ok {
317                         let result = unsafe { o.contents.result };
318                         unsafe { o.contents.result = std::ptr::null_mut() };
319                         CResult_TxCreationKeysErrorZPtr { result }
320                 } else {
321                         let err = unsafe { o.contents.err };
322                         unsafe { o.contents.err = std::ptr::null_mut(); }
323                         CResult_TxCreationKeysErrorZPtr { err }
324                 };
325                 Self {
326                         contents,
327                         result_ok: o.result_ok,
328                 }
329         }
330 }
331 #[repr(C)]
332 pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
333         pub result: *mut crate::ln::chan_utils::HTLCOutputInCommitment,
334         pub err: *mut crate::ln::msgs::DecodeError,
335 }
336 #[repr(C)]
337 pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ {
338         pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr,
339         pub result_ok: bool,
340 }
341 #[no_mangle]
342 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
343         CResult_HTLCOutputInCommitmentDecodeErrorZ {
344                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
345                         result: Box::into_raw(Box::new(o)),
346                 },
347                 result_ok: true,
348         }
349 }
350 #[no_mangle]
351 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ {
352         CResult_HTLCOutputInCommitmentDecodeErrorZ {
353                 contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
354                         err: Box::into_raw(Box::new(e)),
355                 },
356                 result_ok: false,
357         }
358 }
359 #[no_mangle]
360 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { }
361 impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ {
362         fn drop(&mut self) {
363                 if self.result_ok {
364                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
365                                 let _ = unsafe { Box::from_raw(self.contents.result) };
366                         }
367                 } else {
368                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
369                                 let _ = unsafe { Box::from_raw(self.contents.err) };
370                         }
371                 }
372         }
373 }
374 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::HTLCOutputInCommitment, crate::ln::msgs::DecodeError>> for CResult_HTLCOutputInCommitmentDecodeErrorZ {
375         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::HTLCOutputInCommitment, crate::ln::msgs::DecodeError>) -> Self {
376                 let contents = if o.result_ok {
377                         let result = unsafe { o.contents.result };
378                         unsafe { o.contents.result = std::ptr::null_mut() };
379                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result }
380                 } else {
381                         let err = unsafe { o.contents.err };
382                         unsafe { o.contents.err = std::ptr::null_mut(); }
383                         CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err }
384                 };
385                 Self {
386                         contents,
387                         result_ok: o.result_ok,
388                 }
389         }
390 }
391 impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ {
392         fn clone(&self) -> Self {
393                 if self.result_ok {
394                         Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
395                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::HTLCOutputInCommitment>::clone(unsafe { &*self.contents.result })))
396                         } }
397                 } else {
398                         Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr {
399                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
400                         } }
401                 }
402         }
403 }
404 #[no_mangle]
405 pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { orig.clone() }
406 #[repr(C)]
407 pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
408         pub result: *mut crate::ln::chan_utils::CounterpartyChannelTransactionParameters,
409         pub err: *mut crate::ln::msgs::DecodeError,
410 }
411 #[repr(C)]
412 pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
413         pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr,
414         pub result_ok: bool,
415 }
416 #[no_mangle]
417 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
418         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
419                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
420                         result: Box::into_raw(Box::new(o)),
421                 },
422                 result_ok: true,
423         }
424 }
425 #[no_mangle]
426 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
427         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
428                 contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
429                         err: Box::into_raw(Box::new(e)),
430                 },
431                 result_ok: false,
432         }
433 }
434 #[no_mangle]
435 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { }
436 impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
437         fn drop(&mut self) {
438                 if self.result_ok {
439                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
440                                 let _ = unsafe { Box::from_raw(self.contents.result) };
441                         }
442                 } else {
443                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
444                                 let _ = unsafe { Box::from_raw(self.contents.err) };
445                         }
446                 }
447         }
448 }
449 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::ln::msgs::DecodeError>> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
450         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::CounterpartyChannelTransactionParameters, crate::ln::msgs::DecodeError>) -> Self {
451                 let contents = if o.result_ok {
452                         let result = unsafe { o.contents.result };
453                         unsafe { o.contents.result = std::ptr::null_mut() };
454                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result }
455                 } else {
456                         let err = unsafe { o.contents.err };
457                         unsafe { o.contents.err = std::ptr::null_mut(); }
458                         CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err }
459                 };
460                 Self {
461                         contents,
462                         result_ok: o.result_ok,
463                 }
464         }
465 }
466 impl Clone for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
467         fn clone(&self) -> Self {
468                 if self.result_ok {
469                         Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
470                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::CounterpartyChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
471                         } }
472                 } else {
473                         Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
474                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
475                         } }
476                 }
477         }
478 }
479 #[no_mangle]
480 pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { orig.clone() }
481 #[repr(C)]
482 pub union CResult_ChannelTransactionParametersDecodeErrorZPtr {
483         pub result: *mut crate::ln::chan_utils::ChannelTransactionParameters,
484         pub err: *mut crate::ln::msgs::DecodeError,
485 }
486 #[repr(C)]
487 pub struct CResult_ChannelTransactionParametersDecodeErrorZ {
488         pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr,
489         pub result_ok: bool,
490 }
491 #[no_mangle]
492 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ {
493         CResult_ChannelTransactionParametersDecodeErrorZ {
494                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
495                         result: Box::into_raw(Box::new(o)),
496                 },
497                 result_ok: true,
498         }
499 }
500 #[no_mangle]
501 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ {
502         CResult_ChannelTransactionParametersDecodeErrorZ {
503                 contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
504                         err: Box::into_raw(Box::new(e)),
505                 },
506                 result_ok: false,
507         }
508 }
509 #[no_mangle]
510 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { }
511 impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ {
512         fn drop(&mut self) {
513                 if self.result_ok {
514                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
515                                 let _ = unsafe { Box::from_raw(self.contents.result) };
516                         }
517                 } else {
518                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
519                                 let _ = unsafe { Box::from_raw(self.contents.err) };
520                         }
521                 }
522         }
523 }
524 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelTransactionParameters, crate::ln::msgs::DecodeError>> for CResult_ChannelTransactionParametersDecodeErrorZ {
525         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::ChannelTransactionParameters, crate::ln::msgs::DecodeError>) -> Self {
526                 let contents = if o.result_ok {
527                         let result = unsafe { o.contents.result };
528                         unsafe { o.contents.result = std::ptr::null_mut() };
529                         CResult_ChannelTransactionParametersDecodeErrorZPtr { result }
530                 } else {
531                         let err = unsafe { o.contents.err };
532                         unsafe { o.contents.err = std::ptr::null_mut(); }
533                         CResult_ChannelTransactionParametersDecodeErrorZPtr { err }
534                 };
535                 Self {
536                         contents,
537                         result_ok: o.result_ok,
538                 }
539         }
540 }
541 impl Clone for CResult_ChannelTransactionParametersDecodeErrorZ {
542         fn clone(&self) -> Self {
543                 if self.result_ok {
544                         Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
545                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::ChannelTransactionParameters>::clone(unsafe { &*self.contents.result })))
546                         } }
547                 } else {
548                         Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr {
549                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
550                         } }
551                 }
552         }
553 }
554 #[no_mangle]
555 pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { orig.clone() }
556 #[repr(C)]
557 pub struct CVec_SignatureZ {
558         pub data: *mut crate::c_types::Signature,
559         pub datalen: usize
560 }
561 impl CVec_SignatureZ {
562         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Signature> {
563                 if self.datalen == 0 { return Vec::new(); }
564                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
565                 self.data = std::ptr::null_mut();
566                 self.datalen = 0;
567                 ret
568         }
569         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] {
570                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
571         }
572 }
573 impl From<Vec<crate::c_types::Signature>> for CVec_SignatureZ {
574         fn from(v: Vec<crate::c_types::Signature>) -> Self {
575                 let datalen = v.len();
576                 let data = Box::into_raw(v.into_boxed_slice());
577                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
578         }
579 }
580 #[no_mangle]
581 pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { }
582 impl Drop for CVec_SignatureZ {
583         fn drop(&mut self) {
584                 if self.datalen == 0 { return; }
585                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
586         }
587 }
588 impl Clone for CVec_SignatureZ {
589         fn clone(&self) -> Self {
590                 let mut res = Vec::new();
591                 if self.datalen == 0 { return Self::from(res); }
592                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
593                 Self::from(res)
594         }
595 }
596 #[repr(C)]
597 pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr {
598         pub result: *mut crate::ln::chan_utils::HolderCommitmentTransaction,
599         pub err: *mut crate::ln::msgs::DecodeError,
600 }
601 #[repr(C)]
602 pub struct CResult_HolderCommitmentTransactionDecodeErrorZ {
603         pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr,
604         pub result_ok: bool,
605 }
606 #[no_mangle]
607 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
608         CResult_HolderCommitmentTransactionDecodeErrorZ {
609                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
610                         result: Box::into_raw(Box::new(o)),
611                 },
612                 result_ok: true,
613         }
614 }
615 #[no_mangle]
616 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ {
617         CResult_HolderCommitmentTransactionDecodeErrorZ {
618                 contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
619                         err: Box::into_raw(Box::new(e)),
620                 },
621                 result_ok: false,
622         }
623 }
624 #[no_mangle]
625 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { }
626 impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ {
627         fn drop(&mut self) {
628                 if self.result_ok {
629                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
630                                 let _ = unsafe { Box::from_raw(self.contents.result) };
631                         }
632                 } else {
633                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
634                                 let _ = unsafe { Box::from_raw(self.contents.err) };
635                         }
636                 }
637         }
638 }
639 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::HolderCommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_HolderCommitmentTransactionDecodeErrorZ {
640         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::HolderCommitmentTransaction, crate::ln::msgs::DecodeError>) -> Self {
641                 let contents = if o.result_ok {
642                         let result = unsafe { o.contents.result };
643                         unsafe { o.contents.result = std::ptr::null_mut() };
644                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { result }
645                 } else {
646                         let err = unsafe { o.contents.err };
647                         unsafe { o.contents.err = std::ptr::null_mut(); }
648                         CResult_HolderCommitmentTransactionDecodeErrorZPtr { err }
649                 };
650                 Self {
651                         contents,
652                         result_ok: o.result_ok,
653                 }
654         }
655 }
656 impl Clone for CResult_HolderCommitmentTransactionDecodeErrorZ {
657         fn clone(&self) -> Self {
658                 if self.result_ok {
659                         Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
660                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::HolderCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
661                         } }
662                 } else {
663                         Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr {
664                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
665                         } }
666                 }
667         }
668 }
669 #[no_mangle]
670 pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { orig.clone() }
671 #[repr(C)]
672 pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
673         pub result: *mut crate::ln::chan_utils::BuiltCommitmentTransaction,
674         pub err: *mut crate::ln::msgs::DecodeError,
675 }
676 #[repr(C)]
677 pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ {
678         pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr,
679         pub result_ok: bool,
680 }
681 #[no_mangle]
682 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
683         CResult_BuiltCommitmentTransactionDecodeErrorZ {
684                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
685                         result: Box::into_raw(Box::new(o)),
686                 },
687                 result_ok: true,
688         }
689 }
690 #[no_mangle]
691 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ {
692         CResult_BuiltCommitmentTransactionDecodeErrorZ {
693                 contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
694                         err: Box::into_raw(Box::new(e)),
695                 },
696                 result_ok: false,
697         }
698 }
699 #[no_mangle]
700 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { }
701 impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ {
702         fn drop(&mut self) {
703                 if self.result_ok {
704                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
705                                 let _ = unsafe { Box::from_raw(self.contents.result) };
706                         }
707                 } else {
708                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
709                                 let _ = unsafe { Box::from_raw(self.contents.err) };
710                         }
711                 }
712         }
713 }
714 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::BuiltCommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_BuiltCommitmentTransactionDecodeErrorZ {
715         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::BuiltCommitmentTransaction, crate::ln::msgs::DecodeError>) -> Self {
716                 let contents = if o.result_ok {
717                         let result = unsafe { o.contents.result };
718                         unsafe { o.contents.result = std::ptr::null_mut() };
719                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result }
720                 } else {
721                         let err = unsafe { o.contents.err };
722                         unsafe { o.contents.err = std::ptr::null_mut(); }
723                         CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err }
724                 };
725                 Self {
726                         contents,
727                         result_ok: o.result_ok,
728                 }
729         }
730 }
731 impl Clone for CResult_BuiltCommitmentTransactionDecodeErrorZ {
732         fn clone(&self) -> Self {
733                 if self.result_ok {
734                         Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
735                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::BuiltCommitmentTransaction>::clone(unsafe { &*self.contents.result })))
736                         } }
737                 } else {
738                         Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr {
739                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
740                         } }
741                 }
742         }
743 }
744 #[no_mangle]
745 pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { orig.clone() }
746 #[repr(C)]
747 pub union CResult_CommitmentTransactionDecodeErrorZPtr {
748         pub result: *mut crate::ln::chan_utils::CommitmentTransaction,
749         pub err: *mut crate::ln::msgs::DecodeError,
750 }
751 #[repr(C)]
752 pub struct CResult_CommitmentTransactionDecodeErrorZ {
753         pub contents: CResult_CommitmentTransactionDecodeErrorZPtr,
754         pub result_ok: bool,
755 }
756 #[no_mangle]
757 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ {
758         CResult_CommitmentTransactionDecodeErrorZ {
759                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
760                         result: Box::into_raw(Box::new(o)),
761                 },
762                 result_ok: true,
763         }
764 }
765 #[no_mangle]
766 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ {
767         CResult_CommitmentTransactionDecodeErrorZ {
768                 contents: CResult_CommitmentTransactionDecodeErrorZPtr {
769                         err: Box::into_raw(Box::new(e)),
770                 },
771                 result_ok: false,
772         }
773 }
774 #[no_mangle]
775 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { }
776 impl Drop for CResult_CommitmentTransactionDecodeErrorZ {
777         fn drop(&mut self) {
778                 if self.result_ok {
779                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
780                                 let _ = unsafe { Box::from_raw(self.contents.result) };
781                         }
782                 } else {
783                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
784                                 let _ = unsafe { Box::from_raw(self.contents.err) };
785                         }
786                 }
787         }
788 }
789 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::CommitmentTransaction, crate::ln::msgs::DecodeError>> for CResult_CommitmentTransactionDecodeErrorZ {
790         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::CommitmentTransaction, crate::ln::msgs::DecodeError>) -> Self {
791                 let contents = if o.result_ok {
792                         let result = unsafe { o.contents.result };
793                         unsafe { o.contents.result = std::ptr::null_mut() };
794                         CResult_CommitmentTransactionDecodeErrorZPtr { result }
795                 } else {
796                         let err = unsafe { o.contents.err };
797                         unsafe { o.contents.err = std::ptr::null_mut(); }
798                         CResult_CommitmentTransactionDecodeErrorZPtr { err }
799                 };
800                 Self {
801                         contents,
802                         result_ok: o.result_ok,
803                 }
804         }
805 }
806 impl Clone for CResult_CommitmentTransactionDecodeErrorZ {
807         fn clone(&self) -> Self {
808                 if self.result_ok {
809                         Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
810                                 result: Box::into_raw(Box::new(<crate::ln::chan_utils::CommitmentTransaction>::clone(unsafe { &*self.contents.result })))
811                         } }
812                 } else {
813                         Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr {
814                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
815                         } }
816                 }
817         }
818 }
819 #[no_mangle]
820 pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { orig.clone() }
821 #[repr(C)]
822 pub union CResult_TrustedCommitmentTransactionNoneZPtr {
823         pub result: *mut crate::ln::chan_utils::TrustedCommitmentTransaction,
824         /// Note that this value is always NULL, as there are no contents in the Err variant
825         pub err: *mut std::ffi::c_void,
826 }
827 #[repr(C)]
828 pub struct CResult_TrustedCommitmentTransactionNoneZ {
829         pub contents: CResult_TrustedCommitmentTransactionNoneZPtr,
830         pub result_ok: bool,
831 }
832 #[no_mangle]
833 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ {
834         CResult_TrustedCommitmentTransactionNoneZ {
835                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
836                         result: Box::into_raw(Box::new(o)),
837                 },
838                 result_ok: true,
839         }
840 }
841 #[no_mangle]
842 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ {
843         CResult_TrustedCommitmentTransactionNoneZ {
844                 contents: CResult_TrustedCommitmentTransactionNoneZPtr {
845                         err: std::ptr::null_mut(),
846                 },
847                 result_ok: false,
848         }
849 }
850 #[no_mangle]
851 pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { }
852 impl Drop for CResult_TrustedCommitmentTransactionNoneZ {
853         fn drop(&mut self) {
854                 if self.result_ok {
855                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
856                                 let _ = unsafe { Box::from_raw(self.contents.result) };
857                         }
858                 } else {
859                 }
860         }
861 }
862 impl From<crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>> for CResult_TrustedCommitmentTransactionNoneZ {
863         fn from(mut o: crate::c_types::CResultTempl<crate::ln::chan_utils::TrustedCommitmentTransaction, u8>) -> Self {
864                 let contents = if o.result_ok {
865                         let result = unsafe { o.contents.result };
866                         unsafe { o.contents.result = std::ptr::null_mut() };
867                         CResult_TrustedCommitmentTransactionNoneZPtr { result }
868                 } else {
869                         let _ = unsafe { Box::from_raw(o.contents.err) };
870                         o.contents.err = std::ptr::null_mut();
871                         CResult_TrustedCommitmentTransactionNoneZPtr { err: std::ptr::null_mut() }
872                 };
873                 Self {
874                         contents,
875                         result_ok: o.result_ok,
876                 }
877         }
878 }
879 #[repr(C)]
880 pub union CResult_CVec_SignatureZNoneZPtr {
881         pub result: *mut crate::c_types::derived::CVec_SignatureZ,
882         /// Note that this value is always NULL, as there are no contents in the Err variant
883         pub err: *mut std::ffi::c_void,
884 }
885 #[repr(C)]
886 pub struct CResult_CVec_SignatureZNoneZ {
887         pub contents: CResult_CVec_SignatureZNoneZPtr,
888         pub result_ok: bool,
889 }
890 #[no_mangle]
891 pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ {
892         CResult_CVec_SignatureZNoneZ {
893                 contents: CResult_CVec_SignatureZNoneZPtr {
894                         result: Box::into_raw(Box::new(o)),
895                 },
896                 result_ok: true,
897         }
898 }
899 #[no_mangle]
900 pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ {
901         CResult_CVec_SignatureZNoneZ {
902                 contents: CResult_CVec_SignatureZNoneZPtr {
903                         err: std::ptr::null_mut(),
904                 },
905                 result_ok: false,
906         }
907 }
908 #[no_mangle]
909 pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { }
910 impl Drop for CResult_CVec_SignatureZNoneZ {
911         fn drop(&mut self) {
912                 if self.result_ok {
913                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
914                                 let _ = unsafe { Box::from_raw(self.contents.result) };
915                         }
916                 } else {
917                 }
918         }
919 }
920 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>> for CResult_CVec_SignatureZNoneZ {
921         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_SignatureZ, u8>) -> Self {
922                 let contents = if o.result_ok {
923                         let result = unsafe { o.contents.result };
924                         unsafe { o.contents.result = std::ptr::null_mut() };
925                         CResult_CVec_SignatureZNoneZPtr { result }
926                 } else {
927                         let _ = unsafe { Box::from_raw(o.contents.err) };
928                         o.contents.err = std::ptr::null_mut();
929                         CResult_CVec_SignatureZNoneZPtr { err: std::ptr::null_mut() }
930                 };
931                 Self {
932                         contents,
933                         result_ok: o.result_ok,
934                 }
935         }
936 }
937 impl Clone for CResult_CVec_SignatureZNoneZ {
938         fn clone(&self) -> Self {
939                 if self.result_ok {
940                         Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr {
941                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_SignatureZ>::clone(unsafe { &*self.contents.result })))
942                         } }
943                 } else {
944                         Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr {
945                                 err: std::ptr::null_mut()
946                         } }
947                 }
948         }
949 }
950 #[no_mangle]
951 pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { orig.clone() }
952 #[repr(C)]
953 pub struct CVec_PublicKeyZ {
954         pub data: *mut crate::c_types::PublicKey,
955         pub datalen: usize
956 }
957 impl CVec_PublicKeyZ {
958         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
959                 if self.datalen == 0 { return Vec::new(); }
960                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
961                 self.data = std::ptr::null_mut();
962                 self.datalen = 0;
963                 ret
964         }
965         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
966                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
967         }
968 }
969 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
970         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
971                 let datalen = v.len();
972                 let data = Box::into_raw(v.into_boxed_slice());
973                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
974         }
975 }
976 #[no_mangle]
977 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
978 impl Drop for CVec_PublicKeyZ {
979         fn drop(&mut self) {
980                 if self.datalen == 0 { return; }
981                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
982         }
983 }
984 #[repr(C)]
985 pub struct CVec_u8Z {
986         pub data: *mut u8,
987         pub datalen: usize
988 }
989 impl CVec_u8Z {
990         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
991                 if self.datalen == 0 { return Vec::new(); }
992                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
993                 self.data = std::ptr::null_mut();
994                 self.datalen = 0;
995                 ret
996         }
997         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
998                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
999         }
1000 }
1001 impl From<Vec<u8>> for CVec_u8Z {
1002         fn from(v: Vec<u8>) -> Self {
1003                 let datalen = v.len();
1004                 let data = Box::into_raw(v.into_boxed_slice());
1005                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1006         }
1007 }
1008 #[no_mangle]
1009 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
1010 impl Drop for CVec_u8Z {
1011         fn drop(&mut self) {
1012                 if self.datalen == 0 { return; }
1013                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1014         }
1015 }
1016 impl Clone for CVec_u8Z {
1017         fn clone(&self) -> Self {
1018                 let mut res = Vec::new();
1019                 if self.datalen == 0 { return Self::from(res); }
1020                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1021                 Self::from(res)
1022         }
1023 }
1024 #[repr(C)]
1025 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
1026         pub result: *mut crate::c_types::derived::CVec_u8Z,
1027         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1028 }
1029 #[repr(C)]
1030 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
1031         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
1032         pub result_ok: bool,
1033 }
1034 #[no_mangle]
1035 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
1036         CResult_CVec_u8ZPeerHandleErrorZ {
1037                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1038                         result: Box::into_raw(Box::new(o)),
1039                 },
1040                 result_ok: true,
1041         }
1042 }
1043 #[no_mangle]
1044 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
1045         CResult_CVec_u8ZPeerHandleErrorZ {
1046                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1047                         err: Box::into_raw(Box::new(e)),
1048                 },
1049                 result_ok: false,
1050         }
1051 }
1052 #[no_mangle]
1053 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
1054 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
1055         fn drop(&mut self) {
1056                 if self.result_ok {
1057                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1058                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1059                         }
1060                 } else {
1061                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1062                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1063                         }
1064                 }
1065         }
1066 }
1067 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
1068         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
1069                 let contents = if o.result_ok {
1070                         let result = unsafe { o.contents.result };
1071                         unsafe { o.contents.result = std::ptr::null_mut() };
1072                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
1073                 } else {
1074                         let err = unsafe { o.contents.err };
1075                         unsafe { o.contents.err = std::ptr::null_mut(); }
1076                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
1077                 };
1078                 Self {
1079                         contents,
1080                         result_ok: o.result_ok,
1081                 }
1082         }
1083 }
1084 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
1085         fn clone(&self) -> Self {
1086                 if self.result_ok {
1087                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1088                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
1089                         } }
1090                 } else {
1091                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1092                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1093                         } }
1094                 }
1095         }
1096 }
1097 #[no_mangle]
1098 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
1099 #[repr(C)]
1100 pub union CResult_NonePeerHandleErrorZPtr {
1101         /// Note that this value is always NULL, as there are no contents in the OK variant
1102         pub result: *mut std::ffi::c_void,
1103         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1104 }
1105 #[repr(C)]
1106 pub struct CResult_NonePeerHandleErrorZ {
1107         pub contents: CResult_NonePeerHandleErrorZPtr,
1108         pub result_ok: bool,
1109 }
1110 #[no_mangle]
1111 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
1112         CResult_NonePeerHandleErrorZ {
1113                 contents: CResult_NonePeerHandleErrorZPtr {
1114                         result: std::ptr::null_mut(),
1115                 },
1116                 result_ok: true,
1117         }
1118 }
1119 #[no_mangle]
1120 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
1121         CResult_NonePeerHandleErrorZ {
1122                 contents: CResult_NonePeerHandleErrorZPtr {
1123                         err: Box::into_raw(Box::new(e)),
1124                 },
1125                 result_ok: false,
1126         }
1127 }
1128 #[no_mangle]
1129 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
1130 impl Drop for CResult_NonePeerHandleErrorZ {
1131         fn drop(&mut self) {
1132                 if self.result_ok {
1133                 } else {
1134                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1135                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1136                         }
1137                 }
1138         }
1139 }
1140 impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
1141         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
1142                 let contents = if o.result_ok {
1143                         let _ = unsafe { Box::from_raw(o.contents.result) };
1144                         o.contents.result = std::ptr::null_mut();
1145                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
1146                 } else {
1147                         let err = unsafe { o.contents.err };
1148                         unsafe { o.contents.err = std::ptr::null_mut(); }
1149                         CResult_NonePeerHandleErrorZPtr { err }
1150                 };
1151                 Self {
1152                         contents,
1153                         result_ok: o.result_ok,
1154                 }
1155         }
1156 }
1157 impl Clone for CResult_NonePeerHandleErrorZ {
1158         fn clone(&self) -> Self {
1159                 if self.result_ok {
1160                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
1161                                 result: std::ptr::null_mut()
1162                         } }
1163                 } else {
1164                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
1165                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1166                         } }
1167                 }
1168         }
1169 }
1170 #[no_mangle]
1171 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
1172 #[repr(C)]
1173 pub union CResult_boolPeerHandleErrorZPtr {
1174         pub result: *mut bool,
1175         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1176 }
1177 #[repr(C)]
1178 pub struct CResult_boolPeerHandleErrorZ {
1179         pub contents: CResult_boolPeerHandleErrorZPtr,
1180         pub result_ok: bool,
1181 }
1182 #[no_mangle]
1183 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
1184         CResult_boolPeerHandleErrorZ {
1185                 contents: CResult_boolPeerHandleErrorZPtr {
1186                         result: Box::into_raw(Box::new(o)),
1187                 },
1188                 result_ok: true,
1189         }
1190 }
1191 #[no_mangle]
1192 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
1193         CResult_boolPeerHandleErrorZ {
1194                 contents: CResult_boolPeerHandleErrorZPtr {
1195                         err: Box::into_raw(Box::new(e)),
1196                 },
1197                 result_ok: false,
1198         }
1199 }
1200 #[no_mangle]
1201 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
1202 impl Drop for CResult_boolPeerHandleErrorZ {
1203         fn drop(&mut self) {
1204                 if self.result_ok {
1205                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1206                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1207                         }
1208                 } else {
1209                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1210                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1211                         }
1212                 }
1213         }
1214 }
1215 impl From<crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
1216         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>) -> Self {
1217                 let contents = if o.result_ok {
1218                         let result = unsafe { o.contents.result };
1219                         unsafe { o.contents.result = std::ptr::null_mut() };
1220                         CResult_boolPeerHandleErrorZPtr { result }
1221                 } else {
1222                         let err = unsafe { o.contents.err };
1223                         unsafe { o.contents.err = std::ptr::null_mut(); }
1224                         CResult_boolPeerHandleErrorZPtr { err }
1225                 };
1226                 Self {
1227                         contents,
1228                         result_ok: o.result_ok,
1229                 }
1230         }
1231 }
1232 impl Clone for CResult_boolPeerHandleErrorZ {
1233         fn clone(&self) -> Self {
1234                 if self.result_ok {
1235                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
1236                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
1237                         } }
1238                 } else {
1239                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
1240                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1241                         } }
1242                 }
1243         }
1244 }
1245 #[no_mangle]
1246 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
1247 #[repr(C)]
1248 pub union CResult_ChannelConfigDecodeErrorZPtr {
1249         pub result: *mut crate::util::config::ChannelConfig,
1250         pub err: *mut crate::ln::msgs::DecodeError,
1251 }
1252 #[repr(C)]
1253 pub struct CResult_ChannelConfigDecodeErrorZ {
1254         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
1255         pub result_ok: bool,
1256 }
1257 #[no_mangle]
1258 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
1259         CResult_ChannelConfigDecodeErrorZ {
1260                 contents: CResult_ChannelConfigDecodeErrorZPtr {
1261                         result: Box::into_raw(Box::new(o)),
1262                 },
1263                 result_ok: true,
1264         }
1265 }
1266 #[no_mangle]
1267 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
1268         CResult_ChannelConfigDecodeErrorZ {
1269                 contents: CResult_ChannelConfigDecodeErrorZPtr {
1270                         err: Box::into_raw(Box::new(e)),
1271                 },
1272                 result_ok: false,
1273         }
1274 }
1275 #[no_mangle]
1276 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
1277 impl Drop for CResult_ChannelConfigDecodeErrorZ {
1278         fn drop(&mut self) {
1279                 if self.result_ok {
1280                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1281                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1282                         }
1283                 } else {
1284                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1285                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1286                         }
1287                 }
1288         }
1289 }
1290 impl From<crate::c_types::CResultTempl<crate::util::config::ChannelConfig, crate::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
1291         fn from(mut o: crate::c_types::CResultTempl<crate::util::config::ChannelConfig, crate::ln::msgs::DecodeError>) -> Self {
1292                 let contents = if o.result_ok {
1293                         let result = unsafe { o.contents.result };
1294                         unsafe { o.contents.result = std::ptr::null_mut() };
1295                         CResult_ChannelConfigDecodeErrorZPtr { result }
1296                 } else {
1297                         let err = unsafe { o.contents.err };
1298                         unsafe { o.contents.err = std::ptr::null_mut(); }
1299                         CResult_ChannelConfigDecodeErrorZPtr { err }
1300                 };
1301                 Self {
1302                         contents,
1303                         result_ok: o.result_ok,
1304                 }
1305         }
1306 }
1307 impl Clone for CResult_ChannelConfigDecodeErrorZ {
1308         fn clone(&self) -> Self {
1309                 if self.result_ok {
1310                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
1311                                 result: Box::into_raw(Box::new(<crate::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
1312                         } }
1313                 } else {
1314                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
1315                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1316                         } }
1317                 }
1318         }
1319 }
1320 #[no_mangle]
1321 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
1322 #[repr(C)]
1323 pub union CResult_boolLightningErrorZPtr {
1324         pub result: *mut bool,
1325         pub err: *mut crate::ln::msgs::LightningError,
1326 }
1327 #[repr(C)]
1328 pub struct CResult_boolLightningErrorZ {
1329         pub contents: CResult_boolLightningErrorZPtr,
1330         pub result_ok: bool,
1331 }
1332 #[no_mangle]
1333 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
1334         CResult_boolLightningErrorZ {
1335                 contents: CResult_boolLightningErrorZPtr {
1336                         result: Box::into_raw(Box::new(o)),
1337                 },
1338                 result_ok: true,
1339         }
1340 }
1341 #[no_mangle]
1342 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
1343         CResult_boolLightningErrorZ {
1344                 contents: CResult_boolLightningErrorZPtr {
1345                         err: Box::into_raw(Box::new(e)),
1346                 },
1347                 result_ok: false,
1348         }
1349 }
1350 #[no_mangle]
1351 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
1352 impl Drop for CResult_boolLightningErrorZ {
1353         fn drop(&mut self) {
1354                 if self.result_ok {
1355                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1356                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1357                         }
1358                 } else {
1359                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1360                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1361                         }
1362                 }
1363         }
1364 }
1365 impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
1366         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
1367                 let contents = if o.result_ok {
1368                         let result = unsafe { o.contents.result };
1369                         unsafe { o.contents.result = std::ptr::null_mut() };
1370                         CResult_boolLightningErrorZPtr { result }
1371                 } else {
1372                         let err = unsafe { o.contents.err };
1373                         unsafe { o.contents.err = std::ptr::null_mut(); }
1374                         CResult_boolLightningErrorZPtr { err }
1375                 };
1376                 Self {
1377                         contents,
1378                         result_ok: o.result_ok,
1379                 }
1380         }
1381 }
1382 impl Clone for CResult_boolLightningErrorZ {
1383         fn clone(&self) -> Self {
1384                 if self.result_ok {
1385                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
1386                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
1387                         } }
1388                 } else {
1389                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
1390                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1391                         } }
1392                 }
1393         }
1394 }
1395 #[no_mangle]
1396 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
1397 #[repr(C)]
1398 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1399         pub a: crate::ln::msgs::ChannelAnnouncement,
1400         pub b: crate::ln::msgs::ChannelUpdate,
1401         pub c: crate::ln::msgs::ChannelUpdate,
1402 }
1403 impl From<(crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1404         fn from (tup: (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)) -> Self {
1405                 Self {
1406                         a: tup.0,
1407                         b: tup.1,
1408                         c: tup.2,
1409                 }
1410         }
1411 }
1412 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1413         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate) {
1414                 (self.a, self.b, self.c)
1415         }
1416 }
1417 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1418         fn clone(&self) -> Self {
1419                 Self {
1420                         a: self.a.clone(),
1421                         b: self.b.clone(),
1422                         c: self.c.clone(),
1423                 }
1424         }
1425 }
1426 #[no_mangle]
1427 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
1428 #[no_mangle]
1429 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1430         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
1431 }
1432
1433 #[no_mangle]
1434 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
1435 #[repr(C)]
1436 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1437         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
1438         pub datalen: usize
1439 }
1440 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1441         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
1442                 if self.datalen == 0 { return Vec::new(); }
1443                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1444                 self.data = std::ptr::null_mut();
1445                 self.datalen = 0;
1446                 ret
1447         }
1448         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
1449                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1450         }
1451 }
1452 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1453         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
1454                 let datalen = v.len();
1455                 let data = Box::into_raw(v.into_boxed_slice());
1456                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1457         }
1458 }
1459 #[no_mangle]
1460 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
1461 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1462         fn drop(&mut self) {
1463                 if self.datalen == 0 { return; }
1464                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1465         }
1466 }
1467 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1468         fn clone(&self) -> Self {
1469                 let mut res = Vec::new();
1470                 if self.datalen == 0 { return Self::from(res); }
1471                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1472                 Self::from(res)
1473         }
1474 }
1475 #[repr(C)]
1476 pub struct CVec_NodeAnnouncementZ {
1477         pub data: *mut crate::ln::msgs::NodeAnnouncement,
1478         pub datalen: usize
1479 }
1480 impl CVec_NodeAnnouncementZ {
1481         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
1482                 if self.datalen == 0 { return Vec::new(); }
1483                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1484                 self.data = std::ptr::null_mut();
1485                 self.datalen = 0;
1486                 ret
1487         }
1488         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
1489                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1490         }
1491 }
1492 impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
1493         fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
1494                 let datalen = v.len();
1495                 let data = Box::into_raw(v.into_boxed_slice());
1496                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1497         }
1498 }
1499 #[no_mangle]
1500 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
1501 impl Drop for CVec_NodeAnnouncementZ {
1502         fn drop(&mut self) {
1503                 if self.datalen == 0 { return; }
1504                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1505         }
1506 }
1507 impl Clone for CVec_NodeAnnouncementZ {
1508         fn clone(&self) -> Self {
1509                 let mut res = Vec::new();
1510                 if self.datalen == 0 { return Self::from(res); }
1511                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1512                 Self::from(res)
1513         }
1514 }
1515 #[repr(C)]
1516 pub union CResult_NoneLightningErrorZPtr {
1517         /// Note that this value is always NULL, as there are no contents in the OK variant
1518         pub result: *mut std::ffi::c_void,
1519         pub err: *mut crate::ln::msgs::LightningError,
1520 }
1521 #[repr(C)]
1522 pub struct CResult_NoneLightningErrorZ {
1523         pub contents: CResult_NoneLightningErrorZPtr,
1524         pub result_ok: bool,
1525 }
1526 #[no_mangle]
1527 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
1528         CResult_NoneLightningErrorZ {
1529                 contents: CResult_NoneLightningErrorZPtr {
1530                         result: std::ptr::null_mut(),
1531                 },
1532                 result_ok: true,
1533         }
1534 }
1535 #[no_mangle]
1536 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
1537         CResult_NoneLightningErrorZ {
1538                 contents: CResult_NoneLightningErrorZPtr {
1539                         err: Box::into_raw(Box::new(e)),
1540                 },
1541                 result_ok: false,
1542         }
1543 }
1544 #[no_mangle]
1545 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
1546 impl Drop for CResult_NoneLightningErrorZ {
1547         fn drop(&mut self) {
1548                 if self.result_ok {
1549                 } else {
1550                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1551                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1552                         }
1553                 }
1554         }
1555 }
1556 impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
1557         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
1558                 let contents = if o.result_ok {
1559                         let _ = unsafe { Box::from_raw(o.contents.result) };
1560                         o.contents.result = std::ptr::null_mut();
1561                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
1562                 } else {
1563                         let err = unsafe { o.contents.err };
1564                         unsafe { o.contents.err = std::ptr::null_mut(); }
1565                         CResult_NoneLightningErrorZPtr { err }
1566                 };
1567                 Self {
1568                         contents,
1569                         result_ok: o.result_ok,
1570                 }
1571         }
1572 }
1573 impl Clone for CResult_NoneLightningErrorZ {
1574         fn clone(&self) -> Self {
1575                 if self.result_ok {
1576                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
1577                                 result: std::ptr::null_mut()
1578                         } }
1579                 } else {
1580                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
1581                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1582                         } }
1583                 }
1584         }
1585 }
1586 #[no_mangle]
1587 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
1588 #[repr(C)]
1589 pub struct CVec_MessageSendEventZ {
1590         pub data: *mut crate::util::events::MessageSendEvent,
1591         pub datalen: usize
1592 }
1593 impl CVec_MessageSendEventZ {
1594         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::MessageSendEvent> {
1595                 if self.datalen == 0 { return Vec::new(); }
1596                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1597                 self.data = std::ptr::null_mut();
1598                 self.datalen = 0;
1599                 ret
1600         }
1601         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::MessageSendEvent] {
1602                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1603         }
1604 }
1605 impl From<Vec<crate::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
1606         fn from(v: Vec<crate::util::events::MessageSendEvent>) -> Self {
1607                 let datalen = v.len();
1608                 let data = Box::into_raw(v.into_boxed_slice());
1609                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1610         }
1611 }
1612 #[no_mangle]
1613 pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
1614 impl Drop for CVec_MessageSendEventZ {
1615         fn drop(&mut self) {
1616                 if self.datalen == 0 { return; }
1617                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1618         }
1619 }
1620 impl Clone for CVec_MessageSendEventZ {
1621         fn clone(&self) -> Self {
1622                 let mut res = Vec::new();
1623                 if self.datalen == 0 { return Self::from(res); }
1624                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1625                 Self::from(res)
1626         }
1627 }
1628 #[repr(C)]
1629 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
1630         pub result: *mut crate::routing::network_graph::DirectionalChannelInfo,
1631         pub err: *mut crate::ln::msgs::DecodeError,
1632 }
1633 #[repr(C)]
1634 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
1635         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
1636         pub result_ok: bool,
1637 }
1638 #[no_mangle]
1639 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
1640         CResult_DirectionalChannelInfoDecodeErrorZ {
1641                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1642                         result: Box::into_raw(Box::new(o)),
1643                 },
1644                 result_ok: true,
1645         }
1646 }
1647 #[no_mangle]
1648 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
1649         CResult_DirectionalChannelInfoDecodeErrorZ {
1650                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1651                         err: Box::into_raw(Box::new(e)),
1652                 },
1653                 result_ok: false,
1654         }
1655 }
1656 #[no_mangle]
1657 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
1658 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
1659         fn drop(&mut self) {
1660                 if self.result_ok {
1661                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1662                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1663                         }
1664                 } else {
1665                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1666                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1667                         }
1668                 }
1669         }
1670 }
1671 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::DirectionalChannelInfo, crate::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
1672         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::DirectionalChannelInfo, crate::ln::msgs::DecodeError>) -> Self {
1673                 let contents = if o.result_ok {
1674                         let result = unsafe { o.contents.result };
1675                         unsafe { o.contents.result = std::ptr::null_mut() };
1676                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
1677                 } else {
1678                         let err = unsafe { o.contents.err };
1679                         unsafe { o.contents.err = std::ptr::null_mut(); }
1680                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
1681                 };
1682                 Self {
1683                         contents,
1684                         result_ok: o.result_ok,
1685                 }
1686         }
1687 }
1688 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
1689         fn clone(&self) -> Self {
1690                 if self.result_ok {
1691                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1692                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
1693                         } }
1694                 } else {
1695                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1696                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1697                         } }
1698                 }
1699         }
1700 }
1701 #[no_mangle]
1702 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
1703 #[repr(C)]
1704 pub union CResult_ChannelInfoDecodeErrorZPtr {
1705         pub result: *mut crate::routing::network_graph::ChannelInfo,
1706         pub err: *mut crate::ln::msgs::DecodeError,
1707 }
1708 #[repr(C)]
1709 pub struct CResult_ChannelInfoDecodeErrorZ {
1710         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
1711         pub result_ok: bool,
1712 }
1713 #[no_mangle]
1714 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
1715         CResult_ChannelInfoDecodeErrorZ {
1716                 contents: CResult_ChannelInfoDecodeErrorZPtr {
1717                         result: Box::into_raw(Box::new(o)),
1718                 },
1719                 result_ok: true,
1720         }
1721 }
1722 #[no_mangle]
1723 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
1724         CResult_ChannelInfoDecodeErrorZ {
1725                 contents: CResult_ChannelInfoDecodeErrorZPtr {
1726                         err: Box::into_raw(Box::new(e)),
1727                 },
1728                 result_ok: false,
1729         }
1730 }
1731 #[no_mangle]
1732 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
1733 impl Drop for CResult_ChannelInfoDecodeErrorZ {
1734         fn drop(&mut self) {
1735                 if self.result_ok {
1736                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1737                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1738                         }
1739                 } else {
1740                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1741                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1742                         }
1743                 }
1744         }
1745 }
1746 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInfo, crate::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
1747         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInfo, crate::ln::msgs::DecodeError>) -> Self {
1748                 let contents = if o.result_ok {
1749                         let result = unsafe { o.contents.result };
1750                         unsafe { o.contents.result = std::ptr::null_mut() };
1751                         CResult_ChannelInfoDecodeErrorZPtr { result }
1752                 } else {
1753                         let err = unsafe { o.contents.err };
1754                         unsafe { o.contents.err = std::ptr::null_mut(); }
1755                         CResult_ChannelInfoDecodeErrorZPtr { err }
1756                 };
1757                 Self {
1758                         contents,
1759                         result_ok: o.result_ok,
1760                 }
1761         }
1762 }
1763 #[repr(C)]
1764 pub union CResult_RoutingFeesDecodeErrorZPtr {
1765         pub result: *mut crate::routing::network_graph::RoutingFees,
1766         pub err: *mut crate::ln::msgs::DecodeError,
1767 }
1768 #[repr(C)]
1769 pub struct CResult_RoutingFeesDecodeErrorZ {
1770         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
1771         pub result_ok: bool,
1772 }
1773 #[no_mangle]
1774 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
1775         CResult_RoutingFeesDecodeErrorZ {
1776                 contents: CResult_RoutingFeesDecodeErrorZPtr {
1777                         result: Box::into_raw(Box::new(o)),
1778                 },
1779                 result_ok: true,
1780         }
1781 }
1782 #[no_mangle]
1783 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
1784         CResult_RoutingFeesDecodeErrorZ {
1785                 contents: CResult_RoutingFeesDecodeErrorZPtr {
1786                         err: Box::into_raw(Box::new(e)),
1787                 },
1788                 result_ok: false,
1789         }
1790 }
1791 #[no_mangle]
1792 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
1793 impl Drop for CResult_RoutingFeesDecodeErrorZ {
1794         fn drop(&mut self) {
1795                 if self.result_ok {
1796                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1797                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1798                         }
1799                 } else {
1800                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1801                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1802                         }
1803                 }
1804         }
1805 }
1806 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
1807         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>) -> Self {
1808                 let contents = if o.result_ok {
1809                         let result = unsafe { o.contents.result };
1810                         unsafe { o.contents.result = std::ptr::null_mut() };
1811                         CResult_RoutingFeesDecodeErrorZPtr { result }
1812                 } else {
1813                         let err = unsafe { o.contents.err };
1814                         unsafe { o.contents.err = std::ptr::null_mut(); }
1815                         CResult_RoutingFeesDecodeErrorZPtr { err }
1816                 };
1817                 Self {
1818                         contents,
1819                         result_ok: o.result_ok,
1820                 }
1821         }
1822 }
1823 impl Clone for CResult_RoutingFeesDecodeErrorZ {
1824         fn clone(&self) -> Self {
1825                 if self.result_ok {
1826                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
1827                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
1828                         } }
1829                 } else {
1830                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
1831                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1832                         } }
1833                 }
1834         }
1835 }
1836 #[no_mangle]
1837 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
1838 #[repr(C)]
1839 pub struct CVec_NetAddressZ {
1840         pub data: *mut crate::ln::msgs::NetAddress,
1841         pub datalen: usize
1842 }
1843 impl CVec_NetAddressZ {
1844         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NetAddress> {
1845                 if self.datalen == 0 { return Vec::new(); }
1846                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1847                 self.data = std::ptr::null_mut();
1848                 self.datalen = 0;
1849                 ret
1850         }
1851         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NetAddress] {
1852                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1853         }
1854 }
1855 impl From<Vec<crate::ln::msgs::NetAddress>> for CVec_NetAddressZ {
1856         fn from(v: Vec<crate::ln::msgs::NetAddress>) -> Self {
1857                 let datalen = v.len();
1858                 let data = Box::into_raw(v.into_boxed_slice());
1859                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1860         }
1861 }
1862 #[no_mangle]
1863 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
1864 impl Drop for CVec_NetAddressZ {
1865         fn drop(&mut self) {
1866                 if self.datalen == 0 { return; }
1867                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1868         }
1869 }
1870 impl Clone for CVec_NetAddressZ {
1871         fn clone(&self) -> Self {
1872                 let mut res = Vec::new();
1873                 if self.datalen == 0 { return Self::from(res); }
1874                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1875                 Self::from(res)
1876         }
1877 }
1878 #[repr(C)]
1879 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
1880         pub result: *mut crate::routing::network_graph::NodeAnnouncementInfo,
1881         pub err: *mut crate::ln::msgs::DecodeError,
1882 }
1883 #[repr(C)]
1884 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
1885         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
1886         pub result_ok: bool,
1887 }
1888 #[no_mangle]
1889 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
1890         CResult_NodeAnnouncementInfoDecodeErrorZ {
1891                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
1892                         result: Box::into_raw(Box::new(o)),
1893                 },
1894                 result_ok: true,
1895         }
1896 }
1897 #[no_mangle]
1898 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
1899         CResult_NodeAnnouncementInfoDecodeErrorZ {
1900                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
1901                         err: Box::into_raw(Box::new(e)),
1902                 },
1903                 result_ok: false,
1904         }
1905 }
1906 #[no_mangle]
1907 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
1908 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
1909         fn drop(&mut self) {
1910                 if self.result_ok {
1911                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1912                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1913                         }
1914                 } else {
1915                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1916                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1917                         }
1918                 }
1919         }
1920 }
1921 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
1922         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>) -> Self {
1923                 let contents = if o.result_ok {
1924                         let result = unsafe { o.contents.result };
1925                         unsafe { o.contents.result = std::ptr::null_mut() };
1926                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
1927                 } else {
1928                         let err = unsafe { o.contents.err };
1929                         unsafe { o.contents.err = std::ptr::null_mut(); }
1930                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
1931                 };
1932                 Self {
1933                         contents,
1934                         result_ok: o.result_ok,
1935                 }
1936         }
1937 }
1938 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
1939         fn clone(&self) -> Self {
1940                 if self.result_ok {
1941                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
1942                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
1943                         } }
1944                 } else {
1945                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
1946                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1947                         } }
1948                 }
1949         }
1950 }
1951 #[no_mangle]
1952 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
1953 #[repr(C)]
1954 pub struct CVec_u64Z {
1955         pub data: *mut u64,
1956         pub datalen: usize
1957 }
1958 impl CVec_u64Z {
1959         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
1960                 if self.datalen == 0 { return Vec::new(); }
1961                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1962                 self.data = std::ptr::null_mut();
1963                 self.datalen = 0;
1964                 ret
1965         }
1966         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
1967                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1968         }
1969 }
1970 impl From<Vec<u64>> for CVec_u64Z {
1971         fn from(v: Vec<u64>) -> Self {
1972                 let datalen = v.len();
1973                 let data = Box::into_raw(v.into_boxed_slice());
1974                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1975         }
1976 }
1977 #[no_mangle]
1978 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
1979 impl Drop for CVec_u64Z {
1980         fn drop(&mut self) {
1981                 if self.datalen == 0 { return; }
1982                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1983         }
1984 }
1985 impl Clone for CVec_u64Z {
1986         fn clone(&self) -> Self {
1987                 let mut res = Vec::new();
1988                 if self.datalen == 0 { return Self::from(res); }
1989                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1990                 Self::from(res)
1991         }
1992 }
1993 #[repr(C)]
1994 pub union CResult_NodeInfoDecodeErrorZPtr {
1995         pub result: *mut crate::routing::network_graph::NodeInfo,
1996         pub err: *mut crate::ln::msgs::DecodeError,
1997 }
1998 #[repr(C)]
1999 pub struct CResult_NodeInfoDecodeErrorZ {
2000         pub contents: CResult_NodeInfoDecodeErrorZPtr,
2001         pub result_ok: bool,
2002 }
2003 #[no_mangle]
2004 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
2005         CResult_NodeInfoDecodeErrorZ {
2006                 contents: CResult_NodeInfoDecodeErrorZPtr {
2007                         result: Box::into_raw(Box::new(o)),
2008                 },
2009                 result_ok: true,
2010         }
2011 }
2012 #[no_mangle]
2013 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
2014         CResult_NodeInfoDecodeErrorZ {
2015                 contents: CResult_NodeInfoDecodeErrorZPtr {
2016                         err: Box::into_raw(Box::new(e)),
2017                 },
2018                 result_ok: false,
2019         }
2020 }
2021 #[no_mangle]
2022 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
2023 impl Drop for CResult_NodeInfoDecodeErrorZ {
2024         fn drop(&mut self) {
2025                 if self.result_ok {
2026                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2027                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2028                         }
2029                 } else {
2030                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2031                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2032                         }
2033                 }
2034         }
2035 }
2036 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
2037         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>) -> Self {
2038                 let contents = if o.result_ok {
2039                         let result = unsafe { o.contents.result };
2040                         unsafe { o.contents.result = std::ptr::null_mut() };
2041                         CResult_NodeInfoDecodeErrorZPtr { result }
2042                 } else {
2043                         let err = unsafe { o.contents.err };
2044                         unsafe { o.contents.err = std::ptr::null_mut(); }
2045                         CResult_NodeInfoDecodeErrorZPtr { err }
2046                 };
2047                 Self {
2048                         contents,
2049                         result_ok: o.result_ok,
2050                 }
2051         }
2052 }
2053 impl Clone for CResult_NodeInfoDecodeErrorZ {
2054         fn clone(&self) -> Self {
2055                 if self.result_ok {
2056                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
2057                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
2058                         } }
2059                 } else {
2060                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
2061                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2062                         } }
2063                 }
2064         }
2065 }
2066 #[no_mangle]
2067 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
2068 #[repr(C)]
2069 pub union CResult_NetworkGraphDecodeErrorZPtr {
2070         pub result: *mut crate::routing::network_graph::NetworkGraph,
2071         pub err: *mut crate::ln::msgs::DecodeError,
2072 }
2073 #[repr(C)]
2074 pub struct CResult_NetworkGraphDecodeErrorZ {
2075         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
2076         pub result_ok: bool,
2077 }
2078 #[no_mangle]
2079 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
2080         CResult_NetworkGraphDecodeErrorZ {
2081                 contents: CResult_NetworkGraphDecodeErrorZPtr {
2082                         result: Box::into_raw(Box::new(o)),
2083                 },
2084                 result_ok: true,
2085         }
2086 }
2087 #[no_mangle]
2088 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
2089         CResult_NetworkGraphDecodeErrorZ {
2090                 contents: CResult_NetworkGraphDecodeErrorZPtr {
2091                         err: Box::into_raw(Box::new(e)),
2092                 },
2093                 result_ok: false,
2094         }
2095 }
2096 #[no_mangle]
2097 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
2098 impl Drop for CResult_NetworkGraphDecodeErrorZ {
2099         fn drop(&mut self) {
2100                 if self.result_ok {
2101                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2102                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2103                         }
2104                 } else {
2105                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2106                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2107                         }
2108                 }
2109         }
2110 }
2111 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
2112         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>) -> Self {
2113                 let contents = if o.result_ok {
2114                         let result = unsafe { o.contents.result };
2115                         unsafe { o.contents.result = std::ptr::null_mut() };
2116                         CResult_NetworkGraphDecodeErrorZPtr { result }
2117                 } else {
2118                         let err = unsafe { o.contents.err };
2119                         unsafe { o.contents.err = std::ptr::null_mut(); }
2120                         CResult_NetworkGraphDecodeErrorZPtr { err }
2121                 };
2122                 Self {
2123                         contents,
2124                         result_ok: o.result_ok,
2125                 }
2126         }
2127 }
2128 #[repr(C)]
2129 pub struct C2Tuple_usizeTransactionZ {
2130         pub a: usize,
2131         pub b: crate::c_types::Transaction,
2132 }
2133 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2134         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2135                 Self {
2136                         a: tup.0,
2137                         b: tup.1,
2138                 }
2139         }
2140 }
2141 impl C2Tuple_usizeTransactionZ {
2142         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2143                 (self.a, self.b)
2144         }
2145 }
2146 #[no_mangle]
2147 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2148         C2Tuple_usizeTransactionZ { a, b, }
2149 }
2150
2151 #[no_mangle]
2152 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2153 #[repr(C)]
2154 pub struct CVec_C2Tuple_usizeTransactionZZ {
2155         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2156         pub datalen: usize
2157 }
2158 impl CVec_C2Tuple_usizeTransactionZZ {
2159         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2160                 if self.datalen == 0 { return Vec::new(); }
2161                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2162                 self.data = std::ptr::null_mut();
2163                 self.datalen = 0;
2164                 ret
2165         }
2166         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2167                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2168         }
2169 }
2170 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2171         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2172                 let datalen = v.len();
2173                 let data = Box::into_raw(v.into_boxed_slice());
2174                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2175         }
2176 }
2177 #[no_mangle]
2178 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2179 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2180         fn drop(&mut self) {
2181                 if self.datalen == 0 { return; }
2182                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2183         }
2184 }
2185 #[repr(C)]
2186 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2187         /// Note that this value is always NULL, as there are no contents in the OK variant
2188         pub result: *mut std::ffi::c_void,
2189         pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
2190 }
2191 #[repr(C)]
2192 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2193         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2194         pub result_ok: bool,
2195 }
2196 #[no_mangle]
2197 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2198         CResult_NoneChannelMonitorUpdateErrZ {
2199                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2200                         result: std::ptr::null_mut(),
2201                 },
2202                 result_ok: true,
2203         }
2204 }
2205 #[no_mangle]
2206 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2207         CResult_NoneChannelMonitorUpdateErrZ {
2208                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2209                         err: Box::into_raw(Box::new(e)),
2210                 },
2211                 result_ok: false,
2212         }
2213 }
2214 #[no_mangle]
2215 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2216 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2217         fn drop(&mut self) {
2218                 if self.result_ok {
2219                 } else {
2220                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2221                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2222                         }
2223                 }
2224         }
2225 }
2226 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2227         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2228                 let contents = if o.result_ok {
2229                         let _ = unsafe { Box::from_raw(o.contents.result) };
2230                         o.contents.result = std::ptr::null_mut();
2231                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2232                 } else {
2233                         let err = unsafe { o.contents.err };
2234                         unsafe { o.contents.err = std::ptr::null_mut(); }
2235                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2236                 };
2237                 Self {
2238                         contents,
2239                         result_ok: o.result_ok,
2240                 }
2241         }
2242 }
2243 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2244         fn clone(&self) -> Self {
2245                 if self.result_ok {
2246                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2247                                 result: std::ptr::null_mut()
2248                         } }
2249                 } else {
2250                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2251                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2252                         } }
2253                 }
2254         }
2255 }
2256 #[no_mangle]
2257 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2258 #[repr(C)]
2259 pub struct CVec_MonitorEventZ {
2260         pub data: *mut crate::chain::channelmonitor::MonitorEvent,
2261         pub datalen: usize
2262 }
2263 impl CVec_MonitorEventZ {
2264         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
2265                 if self.datalen == 0 { return Vec::new(); }
2266                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2267                 self.data = std::ptr::null_mut();
2268                 self.datalen = 0;
2269                 ret
2270         }
2271         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
2272                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2273         }
2274 }
2275 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2276         fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
2277                 let datalen = v.len();
2278                 let data = Box::into_raw(v.into_boxed_slice());
2279                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2280         }
2281 }
2282 #[no_mangle]
2283 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2284 impl Drop for CVec_MonitorEventZ {
2285         fn drop(&mut self) {
2286                 if self.datalen == 0 { return; }
2287                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2288         }
2289 }
2290 impl Clone for CVec_MonitorEventZ {
2291         fn clone(&self) -> Self {
2292                 let mut res = Vec::new();
2293                 if self.datalen == 0 { return Self::from(res); }
2294                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2295                 Self::from(res)
2296         }
2297 }
2298 #[repr(C)]
2299 pub struct CVec_EventZ {
2300         pub data: *mut crate::util::events::Event,
2301         pub datalen: usize
2302 }
2303 impl CVec_EventZ {
2304         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
2305                 if self.datalen == 0 { return Vec::new(); }
2306                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2307                 self.data = std::ptr::null_mut();
2308                 self.datalen = 0;
2309                 ret
2310         }
2311         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
2312                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2313         }
2314 }
2315 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
2316         fn from(v: Vec<crate::util::events::Event>) -> Self {
2317                 let datalen = v.len();
2318                 let data = Box::into_raw(v.into_boxed_slice());
2319                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2320         }
2321 }
2322 #[no_mangle]
2323 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
2324 impl Drop for CVec_EventZ {
2325         fn drop(&mut self) {
2326                 if self.datalen == 0 { return; }
2327                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2328         }
2329 }
2330 impl Clone for CVec_EventZ {
2331         fn clone(&self) -> Self {
2332                 let mut res = Vec::new();
2333                 if self.datalen == 0 { return Self::from(res); }
2334                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2335                 Self::from(res)
2336         }
2337 }
2338 #[repr(C)]
2339 pub union CResult_OutPointDecodeErrorZPtr {
2340         pub result: *mut crate::chain::transaction::OutPoint,
2341         pub err: *mut crate::ln::msgs::DecodeError,
2342 }
2343 #[repr(C)]
2344 pub struct CResult_OutPointDecodeErrorZ {
2345         pub contents: CResult_OutPointDecodeErrorZPtr,
2346         pub result_ok: bool,
2347 }
2348 #[no_mangle]
2349 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
2350         CResult_OutPointDecodeErrorZ {
2351                 contents: CResult_OutPointDecodeErrorZPtr {
2352                         result: Box::into_raw(Box::new(o)),
2353                 },
2354                 result_ok: true,
2355         }
2356 }
2357 #[no_mangle]
2358 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
2359         CResult_OutPointDecodeErrorZ {
2360                 contents: CResult_OutPointDecodeErrorZPtr {
2361                         err: Box::into_raw(Box::new(e)),
2362                 },
2363                 result_ok: false,
2364         }
2365 }
2366 #[no_mangle]
2367 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
2368 impl Drop for CResult_OutPointDecodeErrorZ {
2369         fn drop(&mut self) {
2370                 if self.result_ok {
2371                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2372                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2373                         }
2374                 } else {
2375                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2376                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2377                         }
2378                 }
2379         }
2380 }
2381 impl From<crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
2382         fn from(mut o: crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>) -> Self {
2383                 let contents = if o.result_ok {
2384                         let result = unsafe { o.contents.result };
2385                         unsafe { o.contents.result = std::ptr::null_mut() };
2386                         CResult_OutPointDecodeErrorZPtr { result }
2387                 } else {
2388                         let err = unsafe { o.contents.err };
2389                         unsafe { o.contents.err = std::ptr::null_mut(); }
2390                         CResult_OutPointDecodeErrorZPtr { err }
2391                 };
2392                 Self {
2393                         contents,
2394                         result_ok: o.result_ok,
2395                 }
2396         }
2397 }
2398 impl Clone for CResult_OutPointDecodeErrorZ {
2399         fn clone(&self) -> Self {
2400                 if self.result_ok {
2401                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
2402                                 result: Box::into_raw(Box::new(<crate::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
2403                         } }
2404                 } else {
2405                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
2406                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2407                         } }
2408                 }
2409         }
2410 }
2411 #[no_mangle]
2412 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
2413 #[repr(C)]
2414 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2415         pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
2416         pub err: *mut crate::ln::msgs::DecodeError,
2417 }
2418 #[repr(C)]
2419 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
2420         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
2421         pub result_ok: bool,
2422 }
2423 #[no_mangle]
2424 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2425         CResult_ChannelMonitorUpdateDecodeErrorZ {
2426                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2427                         result: Box::into_raw(Box::new(o)),
2428                 },
2429                 result_ok: true,
2430         }
2431 }
2432 #[no_mangle]
2433 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2434         CResult_ChannelMonitorUpdateDecodeErrorZ {
2435                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2436                         err: Box::into_raw(Box::new(e)),
2437                 },
2438                 result_ok: false,
2439         }
2440 }
2441 #[no_mangle]
2442 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
2443 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
2444         fn drop(&mut self) {
2445                 if self.result_ok {
2446                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2447                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2448                         }
2449                 } else {
2450                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2451                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2452                         }
2453                 }
2454         }
2455 }
2456 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
2457         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
2458                 let contents = if o.result_ok {
2459                         let result = unsafe { o.contents.result };
2460                         unsafe { o.contents.result = std::ptr::null_mut() };
2461                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
2462                 } else {
2463                         let err = unsafe { o.contents.err };
2464                         unsafe { o.contents.err = std::ptr::null_mut(); }
2465                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
2466                 };
2467                 Self {
2468                         contents,
2469                         result_ok: o.result_ok,
2470                 }
2471         }
2472 }
2473 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
2474         fn clone(&self) -> Self {
2475                 if self.result_ok {
2476                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2477                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
2478                         } }
2479                 } else {
2480                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2481                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2482                         } }
2483                 }
2484         }
2485 }
2486 #[no_mangle]
2487 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
2488 #[repr(C)]
2489 pub union CResult_HTLCUpdateDecodeErrorZPtr {
2490         pub result: *mut crate::chain::channelmonitor::HTLCUpdate,
2491         pub err: *mut crate::ln::msgs::DecodeError,
2492 }
2493 #[repr(C)]
2494 pub struct CResult_HTLCUpdateDecodeErrorZ {
2495         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
2496         pub result_ok: bool,
2497 }
2498 #[no_mangle]
2499 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
2500         CResult_HTLCUpdateDecodeErrorZ {
2501                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2502                         result: Box::into_raw(Box::new(o)),
2503                 },
2504                 result_ok: true,
2505         }
2506 }
2507 #[no_mangle]
2508 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
2509         CResult_HTLCUpdateDecodeErrorZ {
2510                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2511                         err: Box::into_raw(Box::new(e)),
2512                 },
2513                 result_ok: false,
2514         }
2515 }
2516 #[no_mangle]
2517 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
2518 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
2519         fn drop(&mut self) {
2520                 if self.result_ok {
2521                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2522                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2523                         }
2524                 } else {
2525                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2526                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2527                         }
2528                 }
2529         }
2530 }
2531 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
2532         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>) -> Self {
2533                 let contents = if o.result_ok {
2534                         let result = unsafe { o.contents.result };
2535                         unsafe { o.contents.result = std::ptr::null_mut() };
2536                         CResult_HTLCUpdateDecodeErrorZPtr { result }
2537                 } else {
2538                         let err = unsafe { o.contents.err };
2539                         unsafe { o.contents.err = std::ptr::null_mut(); }
2540                         CResult_HTLCUpdateDecodeErrorZPtr { err }
2541                 };
2542                 Self {
2543                         contents,
2544                         result_ok: o.result_ok,
2545                 }
2546         }
2547 }
2548 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
2549         fn clone(&self) -> Self {
2550                 if self.result_ok {
2551                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2552                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
2553                         } }
2554                 } else {
2555                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2556                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2557                         } }
2558                 }
2559         }
2560 }
2561 #[no_mangle]
2562 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
2563 #[repr(C)]
2564 pub union CResult_NoneMonitorUpdateErrorZPtr {
2565         /// Note that this value is always NULL, as there are no contents in the OK variant
2566         pub result: *mut std::ffi::c_void,
2567         pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
2568 }
2569 #[repr(C)]
2570 pub struct CResult_NoneMonitorUpdateErrorZ {
2571         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
2572         pub result_ok: bool,
2573 }
2574 #[no_mangle]
2575 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
2576         CResult_NoneMonitorUpdateErrorZ {
2577                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2578                         result: std::ptr::null_mut(),
2579                 },
2580                 result_ok: true,
2581         }
2582 }
2583 #[no_mangle]
2584 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
2585         CResult_NoneMonitorUpdateErrorZ {
2586                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2587                         err: Box::into_raw(Box::new(e)),
2588                 },
2589                 result_ok: false,
2590         }
2591 }
2592 #[no_mangle]
2593 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
2594 impl Drop for CResult_NoneMonitorUpdateErrorZ {
2595         fn drop(&mut self) {
2596                 if self.result_ok {
2597                 } else {
2598                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2599                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2600                         }
2601                 }
2602         }
2603 }
2604 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
2605         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
2606                 let contents = if o.result_ok {
2607                         let _ = unsafe { Box::from_raw(o.contents.result) };
2608                         o.contents.result = std::ptr::null_mut();
2609                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
2610                 } else {
2611                         let err = unsafe { o.contents.err };
2612                         unsafe { o.contents.err = std::ptr::null_mut(); }
2613                         CResult_NoneMonitorUpdateErrorZPtr { err }
2614                 };
2615                 Self {
2616                         contents,
2617                         result_ok: o.result_ok,
2618                 }
2619         }
2620 }
2621 impl Clone for CResult_NoneMonitorUpdateErrorZ {
2622         fn clone(&self) -> Self {
2623                 if self.result_ok {
2624                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
2625                                 result: std::ptr::null_mut()
2626                         } }
2627                 } else {
2628                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
2629                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
2630                         } }
2631                 }
2632         }
2633 }
2634 #[no_mangle]
2635 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
2636 #[repr(C)]
2637 pub struct C2Tuple_OutPointScriptZ {
2638         pub a: crate::chain::transaction::OutPoint,
2639         pub b: crate::c_types::derived::CVec_u8Z,
2640 }
2641 impl From<(crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
2642         fn from (tup: (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
2643                 Self {
2644                         a: tup.0,
2645                         b: tup.1,
2646                 }
2647         }
2648 }
2649 impl C2Tuple_OutPointScriptZ {
2650         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
2651                 (self.a, self.b)
2652         }
2653 }
2654 impl Clone for C2Tuple_OutPointScriptZ {
2655         fn clone(&self) -> Self {
2656                 Self {
2657                         a: self.a.clone(),
2658                         b: self.b.clone(),
2659                 }
2660         }
2661 }
2662 #[no_mangle]
2663 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
2664 #[no_mangle]
2665 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
2666         C2Tuple_OutPointScriptZ { a, b, }
2667 }
2668
2669 #[no_mangle]
2670 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
2671 #[repr(C)]
2672 pub struct CVec_TransactionZ {
2673         pub data: *mut crate::c_types::Transaction,
2674         pub datalen: usize
2675 }
2676 impl CVec_TransactionZ {
2677         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
2678                 if self.datalen == 0 { return Vec::new(); }
2679                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2680                 self.data = std::ptr::null_mut();
2681                 self.datalen = 0;
2682                 ret
2683         }
2684         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
2685                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2686         }
2687 }
2688 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
2689         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
2690                 let datalen = v.len();
2691                 let data = Box::into_raw(v.into_boxed_slice());
2692                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2693         }
2694 }
2695 #[no_mangle]
2696 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
2697 impl Drop for CVec_TransactionZ {
2698         fn drop(&mut self) {
2699                 if self.datalen == 0 { return; }
2700                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2701         }
2702 }
2703 #[repr(C)]
2704 pub struct C2Tuple_u32TxOutZ {
2705         pub a: u32,
2706         pub b: crate::c_types::TxOut,
2707 }
2708 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
2709         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
2710                 Self {
2711                         a: tup.0,
2712                         b: tup.1,
2713                 }
2714         }
2715 }
2716 impl C2Tuple_u32TxOutZ {
2717         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
2718                 (self.a, self.b)
2719         }
2720 }
2721 impl Clone for C2Tuple_u32TxOutZ {
2722         fn clone(&self) -> Self {
2723                 Self {
2724                         a: self.a.clone(),
2725                         b: self.b.clone(),
2726                 }
2727         }
2728 }
2729 #[no_mangle]
2730 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
2731 #[no_mangle]
2732 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
2733         C2Tuple_u32TxOutZ { a, b, }
2734 }
2735
2736 #[no_mangle]
2737 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
2738 #[repr(C)]
2739 pub struct CVec_C2Tuple_u32TxOutZZ {
2740         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
2741         pub datalen: usize
2742 }
2743 impl CVec_C2Tuple_u32TxOutZZ {
2744         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
2745                 if self.datalen == 0 { return Vec::new(); }
2746                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2747                 self.data = std::ptr::null_mut();
2748                 self.datalen = 0;
2749                 ret
2750         }
2751         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
2752                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2753         }
2754 }
2755 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
2756         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
2757                 let datalen = v.len();
2758                 let data = Box::into_raw(v.into_boxed_slice());
2759                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2760         }
2761 }
2762 #[no_mangle]
2763 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
2764 impl Drop for CVec_C2Tuple_u32TxOutZZ {
2765         fn drop(&mut self) {
2766                 if self.datalen == 0 { return; }
2767                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2768         }
2769 }
2770 impl Clone for CVec_C2Tuple_u32TxOutZZ {
2771         fn clone(&self) -> Self {
2772                 let mut res = Vec::new();
2773                 if self.datalen == 0 { return Self::from(res); }
2774                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2775                 Self::from(res)
2776         }
2777 }
2778 #[repr(C)]
2779 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2780         pub a: crate::c_types::ThirtyTwoBytes,
2781         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
2782 }
2783 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2784         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
2785                 Self {
2786                         a: tup.0,
2787                         b: tup.1,
2788                 }
2789         }
2790 }
2791 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2792         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
2793                 (self.a, self.b)
2794         }
2795 }
2796 #[no_mangle]
2797 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
2798         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
2799 }
2800
2801 #[no_mangle]
2802 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
2803 #[repr(C)]
2804 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
2805         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
2806         pub datalen: usize
2807 }
2808 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
2809         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
2810                 if self.datalen == 0 { return Vec::new(); }
2811                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2812                 self.data = std::ptr::null_mut();
2813                 self.datalen = 0;
2814                 ret
2815         }
2816         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
2817                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2818         }
2819 }
2820 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
2821         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
2822                 let datalen = v.len();
2823                 let data = Box::into_raw(v.into_boxed_slice());
2824                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2825         }
2826 }
2827 #[no_mangle]
2828 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) { }
2829 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
2830         fn drop(&mut self) {
2831                 if self.datalen == 0 { return; }
2832                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2833         }
2834 }
2835 #[repr(C)]
2836 pub struct C2Tuple_BlockHashChannelMonitorZ {
2837         pub a: crate::c_types::ThirtyTwoBytes,
2838         pub b: crate::chain::channelmonitor::ChannelMonitor,
2839 }
2840 impl From<(crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
2841         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)) -> Self {
2842                 Self {
2843                         a: tup.0,
2844                         b: tup.1,
2845                 }
2846         }
2847 }
2848 impl C2Tuple_BlockHashChannelMonitorZ {
2849         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor) {
2850                 (self.a, self.b)
2851         }
2852 }
2853 #[no_mangle]
2854 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
2855         C2Tuple_BlockHashChannelMonitorZ { a, b, }
2856 }
2857
2858 #[no_mangle]
2859 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
2860 #[repr(C)]
2861 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2862         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
2863         pub err: *mut crate::ln::msgs::DecodeError,
2864 }
2865 #[repr(C)]
2866 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2867         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
2868         pub result_ok: bool,
2869 }
2870 #[no_mangle]
2871 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2872         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2873                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2874                         result: Box::into_raw(Box::new(o)),
2875                 },
2876                 result_ok: true,
2877         }
2878 }
2879 #[no_mangle]
2880 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2881         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2882                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2883                         err: Box::into_raw(Box::new(e)),
2884                 },
2885                 result_ok: false,
2886         }
2887 }
2888 #[no_mangle]
2889 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
2890 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2891         fn drop(&mut self) {
2892                 if self.result_ok {
2893                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2894                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2895                         }
2896                 } else {
2897                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2898                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2899                         }
2900                 }
2901         }
2902 }
2903 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2904         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>) -> Self {
2905                 let contents = if o.result_ok {
2906                         let result = unsafe { o.contents.result };
2907                         unsafe { o.contents.result = std::ptr::null_mut() };
2908                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
2909                 } else {
2910                         let err = unsafe { o.contents.err };
2911                         unsafe { o.contents.err = std::ptr::null_mut(); }
2912                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
2913                 };
2914                 Self {
2915                         contents,
2916                         result_ok: o.result_ok,
2917                 }
2918         }
2919 }
2920 #[repr(C)]
2921 pub struct CVec_SpendableOutputDescriptorZ {
2922         pub data: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
2923         pub datalen: usize
2924 }
2925 impl CVec_SpendableOutputDescriptorZ {
2926         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::keysinterface::SpendableOutputDescriptor> {
2927                 if self.datalen == 0 { return Vec::new(); }
2928                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2929                 self.data = std::ptr::null_mut();
2930                 self.datalen = 0;
2931                 ret
2932         }
2933         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::keysinterface::SpendableOutputDescriptor] {
2934                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2935         }
2936 }
2937 impl From<Vec<crate::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
2938         fn from(v: Vec<crate::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
2939                 let datalen = v.len();
2940                 let data = Box::into_raw(v.into_boxed_slice());
2941                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2942         }
2943 }
2944 #[no_mangle]
2945 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
2946 impl Drop for CVec_SpendableOutputDescriptorZ {
2947         fn drop(&mut self) {
2948                 if self.datalen == 0 { return; }
2949                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2950         }
2951 }
2952 impl Clone for CVec_SpendableOutputDescriptorZ {
2953         fn clone(&self) -> Self {
2954                 let mut res = Vec::new();
2955                 if self.datalen == 0 { return Self::from(res); }
2956                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2957                 Self::from(res)
2958         }
2959 }
2960 #[repr(C)]
2961 pub union CResult_TxOutAccessErrorZPtr {
2962         pub result: *mut crate::c_types::TxOut,
2963         pub err: *mut crate::chain::AccessError,
2964 }
2965 #[repr(C)]
2966 pub struct CResult_TxOutAccessErrorZ {
2967         pub contents: CResult_TxOutAccessErrorZPtr,
2968         pub result_ok: bool,
2969 }
2970 #[no_mangle]
2971 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
2972         CResult_TxOutAccessErrorZ {
2973                 contents: CResult_TxOutAccessErrorZPtr {
2974                         result: Box::into_raw(Box::new(o)),
2975                 },
2976                 result_ok: true,
2977         }
2978 }
2979 #[no_mangle]
2980 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
2981         CResult_TxOutAccessErrorZ {
2982                 contents: CResult_TxOutAccessErrorZPtr {
2983                         err: Box::into_raw(Box::new(e)),
2984                 },
2985                 result_ok: false,
2986         }
2987 }
2988 #[no_mangle]
2989 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
2990 impl Drop for CResult_TxOutAccessErrorZ {
2991         fn drop(&mut self) {
2992                 if self.result_ok {
2993                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2994                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2995                         }
2996                 } else {
2997                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2998                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2999                         }
3000                 }
3001         }
3002 }
3003 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3004         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
3005                 let contents = if o.result_ok {
3006                         let result = unsafe { o.contents.result };
3007                         unsafe { o.contents.result = std::ptr::null_mut() };
3008                         CResult_TxOutAccessErrorZPtr { result }
3009                 } else {
3010                         let err = unsafe { o.contents.err };
3011                         unsafe { o.contents.err = std::ptr::null_mut(); }
3012                         CResult_TxOutAccessErrorZPtr { err }
3013                 };
3014                 Self {
3015                         contents,
3016                         result_ok: o.result_ok,
3017                 }
3018         }
3019 }
3020 impl Clone for CResult_TxOutAccessErrorZ {
3021         fn clone(&self) -> Self {
3022                 if self.result_ok {
3023                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3024                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3025                         } }
3026                 } else {
3027                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3028                                 err: Box::into_raw(Box::new(<crate::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3029                         } }
3030                 }
3031         }
3032 }
3033 #[no_mangle]
3034 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
3035 #[repr(C)]
3036 pub union CResult_NoneAPIErrorZPtr {
3037         /// Note that this value is always NULL, as there are no contents in the OK variant
3038         pub result: *mut std::ffi::c_void,
3039         pub err: *mut crate::util::errors::APIError,
3040 }
3041 #[repr(C)]
3042 pub struct CResult_NoneAPIErrorZ {
3043         pub contents: CResult_NoneAPIErrorZPtr,
3044         pub result_ok: bool,
3045 }
3046 #[no_mangle]
3047 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
3048         CResult_NoneAPIErrorZ {
3049                 contents: CResult_NoneAPIErrorZPtr {
3050                         result: std::ptr::null_mut(),
3051                 },
3052                 result_ok: true,
3053         }
3054 }
3055 #[no_mangle]
3056 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
3057         CResult_NoneAPIErrorZ {
3058                 contents: CResult_NoneAPIErrorZPtr {
3059                         err: Box::into_raw(Box::new(e)),
3060                 },
3061                 result_ok: false,
3062         }
3063 }
3064 #[no_mangle]
3065 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
3066 impl Drop for CResult_NoneAPIErrorZ {
3067         fn drop(&mut self) {
3068                 if self.result_ok {
3069                 } else {
3070                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3071                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3072                         }
3073                 }
3074         }
3075 }
3076 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
3077         fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
3078                 let contents = if o.result_ok {
3079                         let _ = unsafe { Box::from_raw(o.contents.result) };
3080                         o.contents.result = std::ptr::null_mut();
3081                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
3082                 } else {
3083                         let err = unsafe { o.contents.err };
3084                         unsafe { o.contents.err = std::ptr::null_mut(); }
3085                         CResult_NoneAPIErrorZPtr { err }
3086                 };
3087                 Self {
3088                         contents,
3089                         result_ok: o.result_ok,
3090                 }
3091         }
3092 }
3093 impl Clone for CResult_NoneAPIErrorZ {
3094         fn clone(&self) -> Self {
3095                 if self.result_ok {
3096                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
3097                                 result: std::ptr::null_mut()
3098                         } }
3099                 } else {
3100                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
3101                                 err: Box::into_raw(Box::new(<crate::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
3102                         } }
3103                 }
3104         }
3105 }
3106 #[no_mangle]
3107 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
3108 #[repr(C)]
3109 pub struct CVec_ChannelDetailsZ {
3110         pub data: *mut crate::ln::channelmanager::ChannelDetails,
3111         pub datalen: usize
3112 }
3113 impl CVec_ChannelDetailsZ {
3114         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
3115                 if self.datalen == 0 { return Vec::new(); }
3116                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3117                 self.data = std::ptr::null_mut();
3118                 self.datalen = 0;
3119                 ret
3120         }
3121         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
3122                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3123         }
3124 }
3125 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3126         fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
3127                 let datalen = v.len();
3128                 let data = Box::into_raw(v.into_boxed_slice());
3129                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3130         }
3131 }
3132 #[no_mangle]
3133 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3134 impl Drop for CVec_ChannelDetailsZ {
3135         fn drop(&mut self) {
3136                 if self.datalen == 0 { return; }
3137                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3138         }
3139 }
3140 impl Clone for CVec_ChannelDetailsZ {
3141         fn clone(&self) -> Self {
3142                 let mut res = Vec::new();
3143                 if self.datalen == 0 { return Self::from(res); }
3144                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3145                 Self::from(res)
3146         }
3147 }
3148 #[repr(C)]
3149 pub union CResult_NonePaymentSendFailureZPtr {
3150         /// Note that this value is always NULL, as there are no contents in the OK variant
3151         pub result: *mut std::ffi::c_void,
3152         pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
3153 }
3154 #[repr(C)]
3155 pub struct CResult_NonePaymentSendFailureZ {
3156         pub contents: CResult_NonePaymentSendFailureZPtr,
3157         pub result_ok: bool,
3158 }
3159 #[no_mangle]
3160 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
3161         CResult_NonePaymentSendFailureZ {
3162                 contents: CResult_NonePaymentSendFailureZPtr {
3163                         result: std::ptr::null_mut(),
3164                 },
3165                 result_ok: true,
3166         }
3167 }
3168 #[no_mangle]
3169 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
3170         CResult_NonePaymentSendFailureZ {
3171                 contents: CResult_NonePaymentSendFailureZPtr {
3172                         err: Box::into_raw(Box::new(e)),
3173                 },
3174                 result_ok: false,
3175         }
3176 }
3177 #[no_mangle]
3178 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
3179 impl Drop for CResult_NonePaymentSendFailureZ {
3180         fn drop(&mut self) {
3181                 if self.result_ok {
3182                 } else {
3183                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3184                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3185                         }
3186                 }
3187         }
3188 }
3189 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
3190         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
3191                 let contents = if o.result_ok {
3192                         let _ = unsafe { Box::from_raw(o.contents.result) };
3193                         o.contents.result = std::ptr::null_mut();
3194                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
3195                 } else {
3196                         let err = unsafe { o.contents.err };
3197                         unsafe { o.contents.err = std::ptr::null_mut(); }
3198                         CResult_NonePaymentSendFailureZPtr { err }
3199                 };
3200                 Self {
3201                         contents,
3202                         result_ok: o.result_ok,
3203                 }
3204         }
3205 }
3206 impl Clone for CResult_NonePaymentSendFailureZ {
3207         fn clone(&self) -> Self {
3208                 if self.result_ok {
3209                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
3210                                 result: std::ptr::null_mut()
3211                         } }
3212                 } else {
3213                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
3214                                 err: Box::into_raw(Box::new(<crate::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
3215                         } }
3216                 }
3217         }
3218 }
3219 #[no_mangle]
3220 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
3221 #[repr(C)]
3222 pub struct CVec_ChannelMonitorZ {
3223         pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
3224         pub datalen: usize
3225 }
3226 impl CVec_ChannelMonitorZ {
3227         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
3228                 if self.datalen == 0 { return Vec::new(); }
3229                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3230                 self.data = std::ptr::null_mut();
3231                 self.datalen = 0;
3232                 ret
3233         }
3234         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
3235                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3236         }
3237 }
3238 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
3239         fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
3240                 let datalen = v.len();
3241                 let data = Box::into_raw(v.into_boxed_slice());
3242                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3243         }
3244 }
3245 #[no_mangle]
3246 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
3247 impl Drop for CVec_ChannelMonitorZ {
3248         fn drop(&mut self) {
3249                 if self.datalen == 0 { return; }
3250                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3251         }
3252 }
3253 #[repr(C)]
3254 pub struct C2Tuple_BlockHashChannelManagerZ {
3255         pub a: crate::c_types::ThirtyTwoBytes,
3256         pub b: crate::ln::channelmanager::ChannelManager,
3257 }
3258 impl From<(crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
3259         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)) -> Self {
3260                 Self {
3261                         a: tup.0,
3262                         b: tup.1,
3263                 }
3264         }
3265 }
3266 impl C2Tuple_BlockHashChannelManagerZ {
3267         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager) {
3268                 (self.a, self.b)
3269         }
3270 }
3271 #[no_mangle]
3272 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
3273         C2Tuple_BlockHashChannelManagerZ { a, b, }
3274 }
3275
3276 #[no_mangle]
3277 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
3278 #[repr(C)]
3279 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3280         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
3281         pub err: *mut crate::ln::msgs::DecodeError,
3282 }
3283 #[repr(C)]
3284 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3285         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
3286         pub result_ok: bool,
3287 }
3288 #[no_mangle]
3289 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3290         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3291                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3292                         result: Box::into_raw(Box::new(o)),
3293                 },
3294                 result_ok: true,
3295         }
3296 }
3297 #[no_mangle]
3298 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3299         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3300                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3301                         err: Box::into_raw(Box::new(e)),
3302                 },
3303                 result_ok: false,
3304         }
3305 }
3306 #[no_mangle]
3307 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
3308 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3309         fn drop(&mut self) {
3310                 if self.result_ok {
3311                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3312                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3313                         }
3314                 } else {
3315                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3316                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3317                         }
3318                 }
3319         }
3320 }
3321 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3322         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>) -> Self {
3323                 let contents = if o.result_ok {
3324                         let result = unsafe { o.contents.result };
3325                         unsafe { o.contents.result = std::ptr::null_mut() };
3326                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
3327                 } else {
3328                         let err = unsafe { o.contents.err };
3329                         unsafe { o.contents.err = std::ptr::null_mut(); }
3330                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
3331                 };
3332                 Self {
3333                         contents,
3334                         result_ok: o.result_ok,
3335                 }
3336         }
3337 }
3338 #[repr(C)]
3339 pub struct C2Tuple_u64u64Z {
3340         pub a: u64,
3341         pub b: u64,
3342 }
3343 impl From<(u64, u64)> for C2Tuple_u64u64Z {
3344         fn from (tup: (u64, u64)) -> Self {
3345                 Self {
3346                         a: tup.0,
3347                         b: tup.1,
3348                 }
3349         }
3350 }
3351 impl C2Tuple_u64u64Z {
3352         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) {
3353                 (self.a, self.b)
3354         }
3355 }
3356 impl Clone for C2Tuple_u64u64Z {
3357         fn clone(&self) -> Self {
3358                 Self {
3359                         a: self.a.clone(),
3360                         b: self.b.clone(),
3361                 }
3362         }
3363 }
3364 #[no_mangle]
3365 pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { orig.clone() }
3366 #[no_mangle]
3367 pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z {
3368         C2Tuple_u64u64Z { a, b, }
3369 }
3370
3371 #[no_mangle]
3372 pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { }
3373 #[repr(C)]
3374 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3375         pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
3376         pub err: *mut crate::ln::msgs::DecodeError,
3377 }
3378 #[repr(C)]
3379 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3380         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3381         pub result_ok: bool,
3382 }
3383 #[no_mangle]
3384 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3385         CResult_SpendableOutputDescriptorDecodeErrorZ {
3386                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3387                         result: Box::into_raw(Box::new(o)),
3388                 },
3389                 result_ok: true,
3390         }
3391 }
3392 #[no_mangle]
3393 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3394         CResult_SpendableOutputDescriptorDecodeErrorZ {
3395                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3396                         err: Box::into_raw(Box::new(e)),
3397                 },
3398                 result_ok: false,
3399         }
3400 }
3401 #[no_mangle]
3402 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3403 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3404         fn drop(&mut self) {
3405                 if self.result_ok {
3406                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3407                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3408                         }
3409                 } else {
3410                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3411                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3412                         }
3413                 }
3414         }
3415 }
3416 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3417         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
3418                 let contents = if o.result_ok {
3419                         let result = unsafe { o.contents.result };
3420                         unsafe { o.contents.result = std::ptr::null_mut() };
3421                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3422                 } else {
3423                         let err = unsafe { o.contents.err };
3424                         unsafe { o.contents.err = std::ptr::null_mut(); }
3425                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3426                 };
3427                 Self {
3428                         contents,
3429                         result_ok: o.result_ok,
3430                 }
3431         }
3432 }
3433 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3434         fn clone(&self) -> Self {
3435                 if self.result_ok {
3436                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3437                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3438                         } }
3439                 } else {
3440                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3441                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3442                         } }
3443                 }
3444         }
3445 }
3446 #[no_mangle]
3447 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
3448 #[repr(C)]
3449 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3450         pub a: crate::c_types::Signature,
3451         pub b: crate::c_types::derived::CVec_SignatureZ,
3452 }
3453 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3454         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3455                 Self {
3456                         a: tup.0,
3457                         b: tup.1,
3458                 }
3459         }
3460 }
3461 impl C2Tuple_SignatureCVec_SignatureZZ {
3462         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3463                 (self.a, self.b)
3464         }
3465 }
3466 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3467         fn clone(&self) -> Self {
3468                 Self {
3469                         a: self.a.clone(),
3470                         b: self.b.clone(),
3471                 }
3472         }
3473 }
3474 #[no_mangle]
3475 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
3476 #[no_mangle]
3477 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3478         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3479 }
3480
3481 #[no_mangle]
3482 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3483 #[repr(C)]
3484 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3485         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3486         /// Note that this value is always NULL, as there are no contents in the Err variant
3487         pub err: *mut std::ffi::c_void,
3488 }
3489 #[repr(C)]
3490 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3491         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3492         pub result_ok: bool,
3493 }
3494 #[no_mangle]
3495 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3496         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3497                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3498                         result: Box::into_raw(Box::new(o)),
3499                 },
3500                 result_ok: true,
3501         }
3502 }
3503 #[no_mangle]
3504 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3505         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3506                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3507                         err: std::ptr::null_mut(),
3508                 },
3509                 result_ok: false,
3510         }
3511 }
3512 #[no_mangle]
3513 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3514 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3515         fn drop(&mut self) {
3516                 if self.result_ok {
3517                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3518                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3519                         }
3520                 } else {
3521                 }
3522         }
3523 }
3524 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3525         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
3526                 let contents = if o.result_ok {
3527                         let result = unsafe { o.contents.result };
3528                         unsafe { o.contents.result = std::ptr::null_mut() };
3529                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3530                 } else {
3531                         let _ = unsafe { Box::from_raw(o.contents.err) };
3532                         o.contents.err = std::ptr::null_mut();
3533                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3534                 };
3535                 Self {
3536                         contents,
3537                         result_ok: o.result_ok,
3538                 }
3539         }
3540 }
3541 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3542         fn clone(&self) -> Self {
3543                 if self.result_ok {
3544                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3545                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
3546                         } }
3547                 } else {
3548                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3549                                 err: std::ptr::null_mut()
3550                         } }
3551                 }
3552         }
3553 }
3554 #[no_mangle]
3555 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
3556 #[repr(C)]
3557 pub union CResult_SignatureNoneZPtr {
3558         pub result: *mut crate::c_types::Signature,
3559         /// Note that this value is always NULL, as there are no contents in the Err variant
3560         pub err: *mut std::ffi::c_void,
3561 }
3562 #[repr(C)]
3563 pub struct CResult_SignatureNoneZ {
3564         pub contents: CResult_SignatureNoneZPtr,
3565         pub result_ok: bool,
3566 }
3567 #[no_mangle]
3568 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
3569         CResult_SignatureNoneZ {
3570                 contents: CResult_SignatureNoneZPtr {
3571                         result: Box::into_raw(Box::new(o)),
3572                 },
3573                 result_ok: true,
3574         }
3575 }
3576 #[no_mangle]
3577 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
3578         CResult_SignatureNoneZ {
3579                 contents: CResult_SignatureNoneZPtr {
3580                         err: std::ptr::null_mut(),
3581                 },
3582                 result_ok: false,
3583         }
3584 }
3585 #[no_mangle]
3586 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
3587 impl Drop for CResult_SignatureNoneZ {
3588         fn drop(&mut self) {
3589                 if self.result_ok {
3590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3592                         }
3593                 } else {
3594                 }
3595         }
3596 }
3597 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
3598         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
3599                 let contents = if o.result_ok {
3600                         let result = unsafe { o.contents.result };
3601                         unsafe { o.contents.result = std::ptr::null_mut() };
3602                         CResult_SignatureNoneZPtr { result }
3603                 } else {
3604                         let _ = unsafe { Box::from_raw(o.contents.err) };
3605                         o.contents.err = std::ptr::null_mut();
3606                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
3607                 };
3608                 Self {
3609                         contents,
3610                         result_ok: o.result_ok,
3611                 }
3612         }
3613 }
3614 impl Clone for CResult_SignatureNoneZ {
3615         fn clone(&self) -> Self {
3616                 if self.result_ok {
3617                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
3618                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
3619                         } }
3620                 } else {
3621                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
3622                                 err: std::ptr::null_mut()
3623                         } }
3624                 }
3625         }
3626 }
3627 #[no_mangle]
3628 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
3629 #[repr(C)]
3630 pub union CResult_ChannelKeysDecodeErrorZPtr {
3631         pub result: *mut crate::chain::keysinterface::ChannelKeys,
3632         pub err: *mut crate::ln::msgs::DecodeError,
3633 }
3634 #[repr(C)]
3635 pub struct CResult_ChannelKeysDecodeErrorZ {
3636         pub contents: CResult_ChannelKeysDecodeErrorZPtr,
3637         pub result_ok: bool,
3638 }
3639 #[no_mangle]
3640 pub extern "C" fn CResult_ChannelKeysDecodeErrorZ_ok(o: crate::chain::keysinterface::ChannelKeys) -> CResult_ChannelKeysDecodeErrorZ {
3641         CResult_ChannelKeysDecodeErrorZ {
3642                 contents: CResult_ChannelKeysDecodeErrorZPtr {
3643                         result: Box::into_raw(Box::new(o)),
3644                 },
3645                 result_ok: true,
3646         }
3647 }
3648 #[no_mangle]
3649 pub extern "C" fn CResult_ChannelKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelKeysDecodeErrorZ {
3650         CResult_ChannelKeysDecodeErrorZ {
3651                 contents: CResult_ChannelKeysDecodeErrorZPtr {
3652                         err: Box::into_raw(Box::new(e)),
3653                 },
3654                 result_ok: false,
3655         }
3656 }
3657 #[no_mangle]
3658 pub extern "C" fn CResult_ChannelKeysDecodeErrorZ_free(_res: CResult_ChannelKeysDecodeErrorZ) { }
3659 impl Drop for CResult_ChannelKeysDecodeErrorZ {
3660         fn drop(&mut self) {
3661                 if self.result_ok {
3662                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3663                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3664                         }
3665                 } else {
3666                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3667                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3668                         }
3669                 }
3670         }
3671 }
3672 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>> for CResult_ChannelKeysDecodeErrorZ {
3673         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::ChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
3674                 let contents = if o.result_ok {
3675                         let result = unsafe { o.contents.result };
3676                         unsafe { o.contents.result = std::ptr::null_mut() };
3677                         CResult_ChannelKeysDecodeErrorZPtr { result }
3678                 } else {
3679                         let err = unsafe { o.contents.err };
3680                         unsafe { o.contents.err = std::ptr::null_mut(); }
3681                         CResult_ChannelKeysDecodeErrorZPtr { err }
3682                 };
3683                 Self {
3684                         contents,
3685                         result_ok: o.result_ok,
3686                 }
3687         }
3688 }
3689 impl Clone for CResult_ChannelKeysDecodeErrorZ {
3690         fn clone(&self) -> Self {
3691                 if self.result_ok {
3692                         Self { result_ok: true, contents: CResult_ChannelKeysDecodeErrorZPtr {
3693                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::ChannelKeys>::clone(unsafe { &*self.contents.result })))
3694                         } }
3695                 } else {
3696                         Self { result_ok: false, contents: CResult_ChannelKeysDecodeErrorZPtr {
3697                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3698                         } }
3699                 }
3700         }
3701 }
3702 #[no_mangle]
3703 pub extern "C" fn CResult_ChannelKeysDecodeErrorZ_clone(orig: &CResult_ChannelKeysDecodeErrorZ) -> CResult_ChannelKeysDecodeErrorZ { orig.clone() }
3704 #[repr(C)]
3705 pub union CResult_InMemoryChannelKeysDecodeErrorZPtr {
3706         pub result: *mut crate::chain::keysinterface::InMemoryChannelKeys,
3707         pub err: *mut crate::ln::msgs::DecodeError,
3708 }
3709 #[repr(C)]
3710 pub struct CResult_InMemoryChannelKeysDecodeErrorZ {
3711         pub contents: CResult_InMemoryChannelKeysDecodeErrorZPtr,
3712         pub result_ok: bool,
3713 }
3714 #[no_mangle]
3715 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemoryChannelKeys) -> CResult_InMemoryChannelKeysDecodeErrorZ {
3716         CResult_InMemoryChannelKeysDecodeErrorZ {
3717                 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
3718                         result: Box::into_raw(Box::new(o)),
3719                 },
3720                 result_ok: true,
3721         }
3722 }
3723 #[no_mangle]
3724 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemoryChannelKeysDecodeErrorZ {
3725         CResult_InMemoryChannelKeysDecodeErrorZ {
3726                 contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
3727                         err: Box::into_raw(Box::new(e)),
3728                 },
3729                 result_ok: false,
3730         }
3731 }
3732 #[no_mangle]
3733 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_free(_res: CResult_InMemoryChannelKeysDecodeErrorZ) { }
3734 impl Drop for CResult_InMemoryChannelKeysDecodeErrorZ {
3735         fn drop(&mut self) {
3736                 if self.result_ok {
3737                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3738                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3739                         }
3740                 } else {
3741                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3742                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3743                         }
3744                 }
3745         }
3746 }
3747 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>> for CResult_InMemoryChannelKeysDecodeErrorZ {
3748         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemoryChannelKeys, crate::ln::msgs::DecodeError>) -> Self {
3749                 let contents = if o.result_ok {
3750                         let result = unsafe { o.contents.result };
3751                         unsafe { o.contents.result = std::ptr::null_mut() };
3752                         CResult_InMemoryChannelKeysDecodeErrorZPtr { result }
3753                 } else {
3754                         let err = unsafe { o.contents.err };
3755                         unsafe { o.contents.err = std::ptr::null_mut(); }
3756                         CResult_InMemoryChannelKeysDecodeErrorZPtr { err }
3757                 };
3758                 Self {
3759                         contents,
3760                         result_ok: o.result_ok,
3761                 }
3762         }
3763 }
3764 impl Clone for CResult_InMemoryChannelKeysDecodeErrorZ {
3765         fn clone(&self) -> Self {
3766                 if self.result_ok {
3767                         Self { result_ok: true, contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
3768                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::InMemoryChannelKeys>::clone(unsafe { &*self.contents.result })))
3769                         } }
3770                 } else {
3771                         Self { result_ok: false, contents: CResult_InMemoryChannelKeysDecodeErrorZPtr {
3772                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3773                         } }
3774                 }
3775         }
3776 }
3777 #[no_mangle]
3778 pub extern "C" fn CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig: &CResult_InMemoryChannelKeysDecodeErrorZ) -> CResult_InMemoryChannelKeysDecodeErrorZ { orig.clone() }
3779 #[repr(C)]
3780 pub struct CVec_RouteHopZ {
3781         pub data: *mut crate::routing::router::RouteHop,
3782         pub datalen: usize
3783 }
3784 impl CVec_RouteHopZ {
3785         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
3786                 if self.datalen == 0 { return Vec::new(); }
3787                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3788                 self.data = std::ptr::null_mut();
3789                 self.datalen = 0;
3790                 ret
3791         }
3792         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
3793                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3794         }
3795 }
3796 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
3797         fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
3798                 let datalen = v.len();
3799                 let data = Box::into_raw(v.into_boxed_slice());
3800                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3801         }
3802 }
3803 #[no_mangle]
3804 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
3805 impl Drop for CVec_RouteHopZ {
3806         fn drop(&mut self) {
3807                 if self.datalen == 0 { return; }
3808                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3809         }
3810 }
3811 impl Clone for CVec_RouteHopZ {
3812         fn clone(&self) -> Self {
3813                 let mut res = Vec::new();
3814                 if self.datalen == 0 { return Self::from(res); }
3815                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3816                 Self::from(res)
3817         }
3818 }
3819 #[repr(C)]
3820 pub struct CVec_CVec_RouteHopZZ {
3821         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
3822         pub datalen: usize
3823 }
3824 impl CVec_CVec_RouteHopZZ {
3825         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
3826                 if self.datalen == 0 { return Vec::new(); }
3827                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3828                 self.data = std::ptr::null_mut();
3829                 self.datalen = 0;
3830                 ret
3831         }
3832         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
3833                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3834         }
3835 }
3836 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
3837         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
3838                 let datalen = v.len();
3839                 let data = Box::into_raw(v.into_boxed_slice());
3840                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3841         }
3842 }
3843 #[no_mangle]
3844 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
3845 impl Drop for CVec_CVec_RouteHopZZ {
3846         fn drop(&mut self) {
3847                 if self.datalen == 0 { return; }
3848                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3849         }
3850 }
3851 impl Clone for CVec_CVec_RouteHopZZ {
3852         fn clone(&self) -> Self {
3853                 let mut res = Vec::new();
3854                 if self.datalen == 0 { return Self::from(res); }
3855                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3856                 Self::from(res)
3857         }
3858 }
3859 #[repr(C)]
3860 pub union CResult_RouteDecodeErrorZPtr {
3861         pub result: *mut crate::routing::router::Route,
3862         pub err: *mut crate::ln::msgs::DecodeError,
3863 }
3864 #[repr(C)]
3865 pub struct CResult_RouteDecodeErrorZ {
3866         pub contents: CResult_RouteDecodeErrorZPtr,
3867         pub result_ok: bool,
3868 }
3869 #[no_mangle]
3870 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
3871         CResult_RouteDecodeErrorZ {
3872                 contents: CResult_RouteDecodeErrorZPtr {
3873                         result: Box::into_raw(Box::new(o)),
3874                 },
3875                 result_ok: true,
3876         }
3877 }
3878 #[no_mangle]
3879 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
3880         CResult_RouteDecodeErrorZ {
3881                 contents: CResult_RouteDecodeErrorZPtr {
3882                         err: Box::into_raw(Box::new(e)),
3883                 },
3884                 result_ok: false,
3885         }
3886 }
3887 #[no_mangle]
3888 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
3889 impl Drop for CResult_RouteDecodeErrorZ {
3890         fn drop(&mut self) {
3891                 if self.result_ok {
3892                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3893                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3894                         }
3895                 } else {
3896                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3897                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3898                         }
3899                 }
3900         }
3901 }
3902 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
3903         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
3904                 let contents = if o.result_ok {
3905                         let result = unsafe { o.contents.result };
3906                         unsafe { o.contents.result = std::ptr::null_mut() };
3907                         CResult_RouteDecodeErrorZPtr { result }
3908                 } else {
3909                         let err = unsafe { o.contents.err };
3910                         unsafe { o.contents.err = std::ptr::null_mut(); }
3911                         CResult_RouteDecodeErrorZPtr { err }
3912                 };
3913                 Self {
3914                         contents,
3915                         result_ok: o.result_ok,
3916                 }
3917         }
3918 }
3919 impl Clone for CResult_RouteDecodeErrorZ {
3920         fn clone(&self) -> Self {
3921                 if self.result_ok {
3922                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
3923                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
3924                         } }
3925                 } else {
3926                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
3927                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3928                         } }
3929                 }
3930         }
3931 }
3932 #[no_mangle]
3933 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
3934 #[repr(C)]
3935 pub struct CVec_RouteHintZ {
3936         pub data: *mut crate::routing::router::RouteHint,
3937         pub datalen: usize
3938 }
3939 impl CVec_RouteHintZ {
3940         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
3941                 if self.datalen == 0 { return Vec::new(); }
3942                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3943                 self.data = std::ptr::null_mut();
3944                 self.datalen = 0;
3945                 ret
3946         }
3947         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
3948                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3949         }
3950 }
3951 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
3952         fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
3953                 let datalen = v.len();
3954                 let data = Box::into_raw(v.into_boxed_slice());
3955                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3956         }
3957 }
3958 #[no_mangle]
3959 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
3960 impl Drop for CVec_RouteHintZ {
3961         fn drop(&mut self) {
3962                 if self.datalen == 0 { return; }
3963                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3964         }
3965 }
3966 impl Clone for CVec_RouteHintZ {
3967         fn clone(&self) -> Self {
3968                 let mut res = Vec::new();
3969                 if self.datalen == 0 { return Self::from(res); }
3970                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3971                 Self::from(res)
3972         }
3973 }
3974 #[repr(C)]
3975 pub union CResult_RouteLightningErrorZPtr {
3976         pub result: *mut crate::routing::router::Route,
3977         pub err: *mut crate::ln::msgs::LightningError,
3978 }
3979 #[repr(C)]
3980 pub struct CResult_RouteLightningErrorZ {
3981         pub contents: CResult_RouteLightningErrorZPtr,
3982         pub result_ok: bool,
3983 }
3984 #[no_mangle]
3985 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
3986         CResult_RouteLightningErrorZ {
3987                 contents: CResult_RouteLightningErrorZPtr {
3988                         result: Box::into_raw(Box::new(o)),
3989                 },
3990                 result_ok: true,
3991         }
3992 }
3993 #[no_mangle]
3994 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
3995         CResult_RouteLightningErrorZ {
3996                 contents: CResult_RouteLightningErrorZPtr {
3997                         err: Box::into_raw(Box::new(e)),
3998                 },
3999                 result_ok: false,
4000         }
4001 }
4002 #[no_mangle]
4003 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
4004 impl Drop for CResult_RouteLightningErrorZ {
4005         fn drop(&mut self) {
4006                 if self.result_ok {
4007                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4008                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4009                         }
4010                 } else {
4011                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4012                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4013                         }
4014                 }
4015         }
4016 }
4017 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
4018         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
4019                 let contents = if o.result_ok {
4020                         let result = unsafe { o.contents.result };
4021                         unsafe { o.contents.result = std::ptr::null_mut() };
4022                         CResult_RouteLightningErrorZPtr { result }
4023                 } else {
4024                         let err = unsafe { o.contents.err };
4025                         unsafe { o.contents.err = std::ptr::null_mut(); }
4026                         CResult_RouteLightningErrorZPtr { err }
4027                 };
4028                 Self {
4029                         contents,
4030                         result_ok: o.result_ok,
4031                 }
4032         }
4033 }
4034 impl Clone for CResult_RouteLightningErrorZ {
4035         fn clone(&self) -> Self {
4036                 if self.result_ok {
4037                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
4038                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4039                         } }
4040                 } else {
4041                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
4042                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4043                         } }
4044                 }
4045         }
4046 }
4047 #[no_mangle]
4048 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
4049 #[repr(C)]
4050 pub union CResult_NetAddressu8ZPtr {
4051         pub result: *mut crate::ln::msgs::NetAddress,
4052         pub err: *mut u8,
4053 }
4054 #[repr(C)]
4055 pub struct CResult_NetAddressu8Z {
4056         pub contents: CResult_NetAddressu8ZPtr,
4057         pub result_ok: bool,
4058 }
4059 #[no_mangle]
4060 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
4061         CResult_NetAddressu8Z {
4062                 contents: CResult_NetAddressu8ZPtr {
4063                         result: Box::into_raw(Box::new(o)),
4064                 },
4065                 result_ok: true,
4066         }
4067 }
4068 #[no_mangle]
4069 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
4070         CResult_NetAddressu8Z {
4071                 contents: CResult_NetAddressu8ZPtr {
4072                         err: Box::into_raw(Box::new(e)),
4073                 },
4074                 result_ok: false,
4075         }
4076 }
4077 #[no_mangle]
4078 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
4079 impl Drop for CResult_NetAddressu8Z {
4080         fn drop(&mut self) {
4081                 if self.result_ok {
4082                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4083                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4084                         }
4085                 } else {
4086                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4087                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4088                         }
4089                 }
4090         }
4091 }
4092 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
4093         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
4094                 let contents = if o.result_ok {
4095                         let result = unsafe { o.contents.result };
4096                         unsafe { o.contents.result = std::ptr::null_mut() };
4097                         CResult_NetAddressu8ZPtr { result }
4098                 } else {
4099                         let err = unsafe { o.contents.err };
4100                         unsafe { o.contents.err = std::ptr::null_mut(); }
4101                         CResult_NetAddressu8ZPtr { err }
4102                 };
4103                 Self {
4104                         contents,
4105                         result_ok: o.result_ok,
4106                 }
4107         }
4108 }
4109 impl Clone for CResult_NetAddressu8Z {
4110         fn clone(&self) -> Self {
4111                 if self.result_ok {
4112                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
4113                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
4114                         } }
4115                 } else {
4116                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
4117                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
4118                         } }
4119                 }
4120         }
4121 }
4122 #[no_mangle]
4123 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
4124 #[repr(C)]
4125 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4126         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
4127         pub err: *mut crate::ln::msgs::DecodeError,
4128 }
4129 #[repr(C)]
4130 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
4131         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
4132         pub result_ok: bool,
4133 }
4134 #[no_mangle]
4135 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4136         CResult_CResult_NetAddressu8ZDecodeErrorZ {
4137                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4138                         result: Box::into_raw(Box::new(o)),
4139                 },
4140                 result_ok: true,
4141         }
4142 }
4143 #[no_mangle]
4144 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4145         CResult_CResult_NetAddressu8ZDecodeErrorZ {
4146                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4147                         err: Box::into_raw(Box::new(e)),
4148                 },
4149                 result_ok: false,
4150         }
4151 }
4152 #[no_mangle]
4153 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
4154 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4155         fn drop(&mut self) {
4156                 if self.result_ok {
4157                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4158                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4159                         }
4160                 } else {
4161                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4162                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4163                         }
4164                 }
4165         }
4166 }
4167 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4168         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
4169                 let contents = if o.result_ok {
4170                         let result = unsafe { o.contents.result };
4171                         unsafe { o.contents.result = std::ptr::null_mut() };
4172                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
4173                 } else {
4174                         let err = unsafe { o.contents.err };
4175                         unsafe { o.contents.err = std::ptr::null_mut(); }
4176                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
4177                 };
4178                 Self {
4179                         contents,
4180                         result_ok: o.result_ok,
4181                 }
4182         }
4183 }
4184 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4185         fn clone(&self) -> Self {
4186                 if self.result_ok {
4187                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4188                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
4189                         } }
4190                 } else {
4191                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4192                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4193                         } }
4194                 }
4195         }
4196 }
4197 #[no_mangle]
4198 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
4199 #[repr(C)]
4200 pub struct CVec_UpdateAddHTLCZ {
4201         pub data: *mut crate::ln::msgs::UpdateAddHTLC,
4202         pub datalen: usize
4203 }
4204 impl CVec_UpdateAddHTLCZ {
4205         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
4206                 if self.datalen == 0 { return Vec::new(); }
4207                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4208                 self.data = std::ptr::null_mut();
4209                 self.datalen = 0;
4210                 ret
4211         }
4212         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
4213                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4214         }
4215 }
4216 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
4217         fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
4218                 let datalen = v.len();
4219                 let data = Box::into_raw(v.into_boxed_slice());
4220                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4221         }
4222 }
4223 #[no_mangle]
4224 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
4225 impl Drop for CVec_UpdateAddHTLCZ {
4226         fn drop(&mut self) {
4227                 if self.datalen == 0 { return; }
4228                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4229         }
4230 }
4231 impl Clone for CVec_UpdateAddHTLCZ {
4232         fn clone(&self) -> Self {
4233                 let mut res = Vec::new();
4234                 if self.datalen == 0 { return Self::from(res); }
4235                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4236                 Self::from(res)
4237         }
4238 }
4239 #[repr(C)]
4240 pub struct CVec_UpdateFulfillHTLCZ {
4241         pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
4242         pub datalen: usize
4243 }
4244 impl CVec_UpdateFulfillHTLCZ {
4245         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
4246                 if self.datalen == 0 { return Vec::new(); }
4247                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4248                 self.data = std::ptr::null_mut();
4249                 self.datalen = 0;
4250                 ret
4251         }
4252         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
4253                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4254         }
4255 }
4256 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
4257         fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
4258                 let datalen = v.len();
4259                 let data = Box::into_raw(v.into_boxed_slice());
4260                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4261         }
4262 }
4263 #[no_mangle]
4264 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
4265 impl Drop for CVec_UpdateFulfillHTLCZ {
4266         fn drop(&mut self) {
4267                 if self.datalen == 0 { return; }
4268                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4269         }
4270 }
4271 impl Clone for CVec_UpdateFulfillHTLCZ {
4272         fn clone(&self) -> Self {
4273                 let mut res = Vec::new();
4274                 if self.datalen == 0 { return Self::from(res); }
4275                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4276                 Self::from(res)
4277         }
4278 }
4279 #[repr(C)]
4280 pub struct CVec_UpdateFailHTLCZ {
4281         pub data: *mut crate::ln::msgs::UpdateFailHTLC,
4282         pub datalen: usize
4283 }
4284 impl CVec_UpdateFailHTLCZ {
4285         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
4286                 if self.datalen == 0 { return Vec::new(); }
4287                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4288                 self.data = std::ptr::null_mut();
4289                 self.datalen = 0;
4290                 ret
4291         }
4292         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
4293                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4294         }
4295 }
4296 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
4297         fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
4298                 let datalen = v.len();
4299                 let data = Box::into_raw(v.into_boxed_slice());
4300                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4301         }
4302 }
4303 #[no_mangle]
4304 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
4305 impl Drop for CVec_UpdateFailHTLCZ {
4306         fn drop(&mut self) {
4307                 if self.datalen == 0 { return; }
4308                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4309         }
4310 }
4311 impl Clone for CVec_UpdateFailHTLCZ {
4312         fn clone(&self) -> Self {
4313                 let mut res = Vec::new();
4314                 if self.datalen == 0 { return Self::from(res); }
4315                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4316                 Self::from(res)
4317         }
4318 }
4319 #[repr(C)]
4320 pub struct CVec_UpdateFailMalformedHTLCZ {
4321         pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
4322         pub datalen: usize
4323 }
4324 impl CVec_UpdateFailMalformedHTLCZ {
4325         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
4326                 if self.datalen == 0 { return Vec::new(); }
4327                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4328                 self.data = std::ptr::null_mut();
4329                 self.datalen = 0;
4330                 ret
4331         }
4332         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
4333                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4334         }
4335 }
4336 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
4337         fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
4338                 let datalen = v.len();
4339                 let data = Box::into_raw(v.into_boxed_slice());
4340                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4341         }
4342 }
4343 #[no_mangle]
4344 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
4345 impl Drop for CVec_UpdateFailMalformedHTLCZ {
4346         fn drop(&mut self) {
4347                 if self.datalen == 0 { return; }
4348                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4349         }
4350 }
4351 impl Clone for CVec_UpdateFailMalformedHTLCZ {
4352         fn clone(&self) -> Self {
4353                 let mut res = Vec::new();
4354                 if self.datalen == 0 { return Self::from(res); }
4355                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4356                 Self::from(res)
4357         }
4358 }
4359 #[repr(C)]
4360 pub union CResult_AcceptChannelDecodeErrorZPtr {
4361         pub result: *mut crate::ln::msgs::AcceptChannel,
4362         pub err: *mut crate::ln::msgs::DecodeError,
4363 }
4364 #[repr(C)]
4365 pub struct CResult_AcceptChannelDecodeErrorZ {
4366         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
4367         pub result_ok: bool,
4368 }
4369 #[no_mangle]
4370 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
4371         CResult_AcceptChannelDecodeErrorZ {
4372                 contents: CResult_AcceptChannelDecodeErrorZPtr {
4373                         result: Box::into_raw(Box::new(o)),
4374                 },
4375                 result_ok: true,
4376         }
4377 }
4378 #[no_mangle]
4379 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
4380         CResult_AcceptChannelDecodeErrorZ {
4381                 contents: CResult_AcceptChannelDecodeErrorZPtr {
4382                         err: Box::into_raw(Box::new(e)),
4383                 },
4384                 result_ok: false,
4385         }
4386 }
4387 #[no_mangle]
4388 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
4389 impl Drop for CResult_AcceptChannelDecodeErrorZ {
4390         fn drop(&mut self) {
4391                 if self.result_ok {
4392                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4393                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4394                         }
4395                 } else {
4396                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4397                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4398                         }
4399                 }
4400         }
4401 }
4402 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
4403         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>) -> Self {
4404                 let contents = if o.result_ok {
4405                         let result = unsafe { o.contents.result };
4406                         unsafe { o.contents.result = std::ptr::null_mut() };
4407                         CResult_AcceptChannelDecodeErrorZPtr { result }
4408                 } else {
4409                         let err = unsafe { o.contents.err };
4410                         unsafe { o.contents.err = std::ptr::null_mut(); }
4411                         CResult_AcceptChannelDecodeErrorZPtr { err }
4412                 };
4413                 Self {
4414                         contents,
4415                         result_ok: o.result_ok,
4416                 }
4417         }
4418 }
4419 impl Clone for CResult_AcceptChannelDecodeErrorZ {
4420         fn clone(&self) -> Self {
4421                 if self.result_ok {
4422                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
4423                                 result: Box::into_raw(Box::new(<crate::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
4424                         } }
4425                 } else {
4426                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
4427                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4428                         } }
4429                 }
4430         }
4431 }
4432 #[no_mangle]
4433 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
4434 #[repr(C)]
4435 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
4436         pub result: *mut crate::ln::msgs::AnnouncementSignatures,
4437         pub err: *mut crate::ln::msgs::DecodeError,
4438 }
4439 #[repr(C)]
4440 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
4441         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
4442         pub result_ok: bool,
4443 }
4444 #[no_mangle]
4445 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
4446         CResult_AnnouncementSignaturesDecodeErrorZ {
4447                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
4448                         result: Box::into_raw(Box::new(o)),
4449                 },
4450                 result_ok: true,
4451         }
4452 }
4453 #[no_mangle]
4454 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
4455         CResult_AnnouncementSignaturesDecodeErrorZ {
4456                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
4457                         err: Box::into_raw(Box::new(e)),
4458                 },
4459                 result_ok: false,
4460         }
4461 }
4462 #[no_mangle]
4463 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
4464 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
4465         fn drop(&mut self) {
4466                 if self.result_ok {
4467                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4468                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4469                         }
4470                 } else {
4471                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4472                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4473                         }
4474                 }
4475         }
4476 }
4477 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
4478         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>) -> Self {
4479                 let contents = if o.result_ok {
4480                         let result = unsafe { o.contents.result };
4481                         unsafe { o.contents.result = std::ptr::null_mut() };
4482                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
4483                 } else {
4484                         let err = unsafe { o.contents.err };
4485                         unsafe { o.contents.err = std::ptr::null_mut(); }
4486                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
4487                 };
4488                 Self {
4489                         contents,
4490                         result_ok: o.result_ok,
4491                 }
4492         }
4493 }
4494 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
4495         fn clone(&self) -> Self {
4496                 if self.result_ok {
4497                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
4498                                 result: Box::into_raw(Box::new(<crate::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
4499                         } }
4500                 } else {
4501                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
4502                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4503                         } }
4504                 }
4505         }
4506 }
4507 #[no_mangle]
4508 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
4509 #[repr(C)]
4510 pub union CResult_ChannelReestablishDecodeErrorZPtr {
4511         pub result: *mut crate::ln::msgs::ChannelReestablish,
4512         pub err: *mut crate::ln::msgs::DecodeError,
4513 }
4514 #[repr(C)]
4515 pub struct CResult_ChannelReestablishDecodeErrorZ {
4516         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
4517         pub result_ok: bool,
4518 }
4519 #[no_mangle]
4520 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
4521         CResult_ChannelReestablishDecodeErrorZ {
4522                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
4523                         result: Box::into_raw(Box::new(o)),
4524                 },
4525                 result_ok: true,
4526         }
4527 }
4528 #[no_mangle]
4529 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
4530         CResult_ChannelReestablishDecodeErrorZ {
4531                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
4532                         err: Box::into_raw(Box::new(e)),
4533                 },
4534                 result_ok: false,
4535         }
4536 }
4537 #[no_mangle]
4538 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
4539 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
4540         fn drop(&mut self) {
4541                 if self.result_ok {
4542                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4543                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4544                         }
4545                 } else {
4546                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4547                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4548                         }
4549                 }
4550         }
4551 }
4552 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
4553         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
4554                 let contents = if o.result_ok {
4555                         let result = unsafe { o.contents.result };
4556                         unsafe { o.contents.result = std::ptr::null_mut() };
4557                         CResult_ChannelReestablishDecodeErrorZPtr { result }
4558                 } else {
4559                         let err = unsafe { o.contents.err };
4560                         unsafe { o.contents.err = std::ptr::null_mut(); }
4561                         CResult_ChannelReestablishDecodeErrorZPtr { err }
4562                 };
4563                 Self {
4564                         contents,
4565                         result_ok: o.result_ok,
4566                 }
4567         }
4568 }
4569 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
4570         fn clone(&self) -> Self {
4571                 if self.result_ok {
4572                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
4573                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
4574                         } }
4575                 } else {
4576                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
4577                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4578                         } }
4579                 }
4580         }
4581 }
4582 #[no_mangle]
4583 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
4584 #[repr(C)]
4585 pub union CResult_ClosingSignedDecodeErrorZPtr {
4586         pub result: *mut crate::ln::msgs::ClosingSigned,
4587         pub err: *mut crate::ln::msgs::DecodeError,
4588 }
4589 #[repr(C)]
4590 pub struct CResult_ClosingSignedDecodeErrorZ {
4591         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
4592         pub result_ok: bool,
4593 }
4594 #[no_mangle]
4595 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
4596         CResult_ClosingSignedDecodeErrorZ {
4597                 contents: CResult_ClosingSignedDecodeErrorZPtr {
4598                         result: Box::into_raw(Box::new(o)),
4599                 },
4600                 result_ok: true,
4601         }
4602 }
4603 #[no_mangle]
4604 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
4605         CResult_ClosingSignedDecodeErrorZ {
4606                 contents: CResult_ClosingSignedDecodeErrorZPtr {
4607                         err: Box::into_raw(Box::new(e)),
4608                 },
4609                 result_ok: false,
4610         }
4611 }
4612 #[no_mangle]
4613 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
4614 impl Drop for CResult_ClosingSignedDecodeErrorZ {
4615         fn drop(&mut self) {
4616                 if self.result_ok {
4617                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4618                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4619                         }
4620                 } else {
4621                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4622                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4623                         }
4624                 }
4625         }
4626 }
4627 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
4628         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>) -> Self {
4629                 let contents = if o.result_ok {
4630                         let result = unsafe { o.contents.result };
4631                         unsafe { o.contents.result = std::ptr::null_mut() };
4632                         CResult_ClosingSignedDecodeErrorZPtr { result }
4633                 } else {
4634                         let err = unsafe { o.contents.err };
4635                         unsafe { o.contents.err = std::ptr::null_mut(); }
4636                         CResult_ClosingSignedDecodeErrorZPtr { err }
4637                 };
4638                 Self {
4639                         contents,
4640                         result_ok: o.result_ok,
4641                 }
4642         }
4643 }
4644 impl Clone for CResult_ClosingSignedDecodeErrorZ {
4645         fn clone(&self) -> Self {
4646                 if self.result_ok {
4647                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
4648                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
4649                         } }
4650                 } else {
4651                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
4652                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4653                         } }
4654                 }
4655         }
4656 }
4657 #[no_mangle]
4658 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
4659 #[repr(C)]
4660 pub union CResult_CommitmentSignedDecodeErrorZPtr {
4661         pub result: *mut crate::ln::msgs::CommitmentSigned,
4662         pub err: *mut crate::ln::msgs::DecodeError,
4663 }
4664 #[repr(C)]
4665 pub struct CResult_CommitmentSignedDecodeErrorZ {
4666         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
4667         pub result_ok: bool,
4668 }
4669 #[no_mangle]
4670 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
4671         CResult_CommitmentSignedDecodeErrorZ {
4672                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
4673                         result: Box::into_raw(Box::new(o)),
4674                 },
4675                 result_ok: true,
4676         }
4677 }
4678 #[no_mangle]
4679 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
4680         CResult_CommitmentSignedDecodeErrorZ {
4681                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
4682                         err: Box::into_raw(Box::new(e)),
4683                 },
4684                 result_ok: false,
4685         }
4686 }
4687 #[no_mangle]
4688 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
4689 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
4690         fn drop(&mut self) {
4691                 if self.result_ok {
4692                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4693                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4694                         }
4695                 } else {
4696                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4697                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4698                         }
4699                 }
4700         }
4701 }
4702 impl From<crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
4703         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>) -> Self {
4704                 let contents = if o.result_ok {
4705                         let result = unsafe { o.contents.result };
4706                         unsafe { o.contents.result = std::ptr::null_mut() };
4707                         CResult_CommitmentSignedDecodeErrorZPtr { result }
4708                 } else {
4709                         let err = unsafe { o.contents.err };
4710                         unsafe { o.contents.err = std::ptr::null_mut(); }
4711                         CResult_CommitmentSignedDecodeErrorZPtr { err }
4712                 };
4713                 Self {
4714                         contents,
4715                         result_ok: o.result_ok,
4716                 }
4717         }
4718 }
4719 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
4720         fn clone(&self) -> Self {
4721                 if self.result_ok {
4722                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
4723                                 result: Box::into_raw(Box::new(<crate::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
4724                         } }
4725                 } else {
4726                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
4727                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4728                         } }
4729                 }
4730         }
4731 }
4732 #[no_mangle]
4733 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
4734 #[repr(C)]
4735 pub union CResult_FundingCreatedDecodeErrorZPtr {
4736         pub result: *mut crate::ln::msgs::FundingCreated,
4737         pub err: *mut crate::ln::msgs::DecodeError,
4738 }
4739 #[repr(C)]
4740 pub struct CResult_FundingCreatedDecodeErrorZ {
4741         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
4742         pub result_ok: bool,
4743 }
4744 #[no_mangle]
4745 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
4746         CResult_FundingCreatedDecodeErrorZ {
4747                 contents: CResult_FundingCreatedDecodeErrorZPtr {
4748                         result: Box::into_raw(Box::new(o)),
4749                 },
4750                 result_ok: true,
4751         }
4752 }
4753 #[no_mangle]
4754 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
4755         CResult_FundingCreatedDecodeErrorZ {
4756                 contents: CResult_FundingCreatedDecodeErrorZPtr {
4757                         err: Box::into_raw(Box::new(e)),
4758                 },
4759                 result_ok: false,
4760         }
4761 }
4762 #[no_mangle]
4763 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
4764 impl Drop for CResult_FundingCreatedDecodeErrorZ {
4765         fn drop(&mut self) {
4766                 if self.result_ok {
4767                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4768                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4769                         }
4770                 } else {
4771                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4772                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4773                         }
4774                 }
4775         }
4776 }
4777 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
4778         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>) -> Self {
4779                 let contents = if o.result_ok {
4780                         let result = unsafe { o.contents.result };
4781                         unsafe { o.contents.result = std::ptr::null_mut() };
4782                         CResult_FundingCreatedDecodeErrorZPtr { result }
4783                 } else {
4784                         let err = unsafe { o.contents.err };
4785                         unsafe { o.contents.err = std::ptr::null_mut(); }
4786                         CResult_FundingCreatedDecodeErrorZPtr { err }
4787                 };
4788                 Self {
4789                         contents,
4790                         result_ok: o.result_ok,
4791                 }
4792         }
4793 }
4794 impl Clone for CResult_FundingCreatedDecodeErrorZ {
4795         fn clone(&self) -> Self {
4796                 if self.result_ok {
4797                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
4798                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
4799                         } }
4800                 } else {
4801                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
4802                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4803                         } }
4804                 }
4805         }
4806 }
4807 #[no_mangle]
4808 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
4809 #[repr(C)]
4810 pub union CResult_FundingSignedDecodeErrorZPtr {
4811         pub result: *mut crate::ln::msgs::FundingSigned,
4812         pub err: *mut crate::ln::msgs::DecodeError,
4813 }
4814 #[repr(C)]
4815 pub struct CResult_FundingSignedDecodeErrorZ {
4816         pub contents: CResult_FundingSignedDecodeErrorZPtr,
4817         pub result_ok: bool,
4818 }
4819 #[no_mangle]
4820 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
4821         CResult_FundingSignedDecodeErrorZ {
4822                 contents: CResult_FundingSignedDecodeErrorZPtr {
4823                         result: Box::into_raw(Box::new(o)),
4824                 },
4825                 result_ok: true,
4826         }
4827 }
4828 #[no_mangle]
4829 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
4830         CResult_FundingSignedDecodeErrorZ {
4831                 contents: CResult_FundingSignedDecodeErrorZPtr {
4832                         err: Box::into_raw(Box::new(e)),
4833                 },
4834                 result_ok: false,
4835         }
4836 }
4837 #[no_mangle]
4838 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
4839 impl Drop for CResult_FundingSignedDecodeErrorZ {
4840         fn drop(&mut self) {
4841                 if self.result_ok {
4842                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4843                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4844                         }
4845                 } else {
4846                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4847                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4848                         }
4849                 }
4850         }
4851 }
4852 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
4853         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>) -> Self {
4854                 let contents = if o.result_ok {
4855                         let result = unsafe { o.contents.result };
4856                         unsafe { o.contents.result = std::ptr::null_mut() };
4857                         CResult_FundingSignedDecodeErrorZPtr { result }
4858                 } else {
4859                         let err = unsafe { o.contents.err };
4860                         unsafe { o.contents.err = std::ptr::null_mut(); }
4861                         CResult_FundingSignedDecodeErrorZPtr { err }
4862                 };
4863                 Self {
4864                         contents,
4865                         result_ok: o.result_ok,
4866                 }
4867         }
4868 }
4869 impl Clone for CResult_FundingSignedDecodeErrorZ {
4870         fn clone(&self) -> Self {
4871                 if self.result_ok {
4872                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
4873                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
4874                         } }
4875                 } else {
4876                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
4877                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4878                         } }
4879                 }
4880         }
4881 }
4882 #[no_mangle]
4883 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
4884 #[repr(C)]
4885 pub union CResult_FundingLockedDecodeErrorZPtr {
4886         pub result: *mut crate::ln::msgs::FundingLocked,
4887         pub err: *mut crate::ln::msgs::DecodeError,
4888 }
4889 #[repr(C)]
4890 pub struct CResult_FundingLockedDecodeErrorZ {
4891         pub contents: CResult_FundingLockedDecodeErrorZPtr,
4892         pub result_ok: bool,
4893 }
4894 #[no_mangle]
4895 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
4896         CResult_FundingLockedDecodeErrorZ {
4897                 contents: CResult_FundingLockedDecodeErrorZPtr {
4898                         result: Box::into_raw(Box::new(o)),
4899                 },
4900                 result_ok: true,
4901         }
4902 }
4903 #[no_mangle]
4904 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
4905         CResult_FundingLockedDecodeErrorZ {
4906                 contents: CResult_FundingLockedDecodeErrorZPtr {
4907                         err: Box::into_raw(Box::new(e)),
4908                 },
4909                 result_ok: false,
4910         }
4911 }
4912 #[no_mangle]
4913 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
4914 impl Drop for CResult_FundingLockedDecodeErrorZ {
4915         fn drop(&mut self) {
4916                 if self.result_ok {
4917                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4918                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4919                         }
4920                 } else {
4921                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4922                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4923                         }
4924                 }
4925         }
4926 }
4927 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
4928         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>) -> Self {
4929                 let contents = if o.result_ok {
4930                         let result = unsafe { o.contents.result };
4931                         unsafe { o.contents.result = std::ptr::null_mut() };
4932                         CResult_FundingLockedDecodeErrorZPtr { result }
4933                 } else {
4934                         let err = unsafe { o.contents.err };
4935                         unsafe { o.contents.err = std::ptr::null_mut(); }
4936                         CResult_FundingLockedDecodeErrorZPtr { err }
4937                 };
4938                 Self {
4939                         contents,
4940                         result_ok: o.result_ok,
4941                 }
4942         }
4943 }
4944 impl Clone for CResult_FundingLockedDecodeErrorZ {
4945         fn clone(&self) -> Self {
4946                 if self.result_ok {
4947                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
4948                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
4949                         } }
4950                 } else {
4951                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
4952                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4953                         } }
4954                 }
4955         }
4956 }
4957 #[no_mangle]
4958 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
4959 #[repr(C)]
4960 pub union CResult_InitDecodeErrorZPtr {
4961         pub result: *mut crate::ln::msgs::Init,
4962         pub err: *mut crate::ln::msgs::DecodeError,
4963 }
4964 #[repr(C)]
4965 pub struct CResult_InitDecodeErrorZ {
4966         pub contents: CResult_InitDecodeErrorZPtr,
4967         pub result_ok: bool,
4968 }
4969 #[no_mangle]
4970 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
4971         CResult_InitDecodeErrorZ {
4972                 contents: CResult_InitDecodeErrorZPtr {
4973                         result: Box::into_raw(Box::new(o)),
4974                 },
4975                 result_ok: true,
4976         }
4977 }
4978 #[no_mangle]
4979 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
4980         CResult_InitDecodeErrorZ {
4981                 contents: CResult_InitDecodeErrorZPtr {
4982                         err: Box::into_raw(Box::new(e)),
4983                 },
4984                 result_ok: false,
4985         }
4986 }
4987 #[no_mangle]
4988 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
4989 impl Drop for CResult_InitDecodeErrorZ {
4990         fn drop(&mut self) {
4991                 if self.result_ok {
4992                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4993                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4994                         }
4995                 } else {
4996                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4997                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4998                         }
4999                 }
5000         }
5001 }
5002 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
5003         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
5004                 let contents = if o.result_ok {
5005                         let result = unsafe { o.contents.result };
5006                         unsafe { o.contents.result = std::ptr::null_mut() };
5007                         CResult_InitDecodeErrorZPtr { result }
5008                 } else {
5009                         let err = unsafe { o.contents.err };
5010                         unsafe { o.contents.err = std::ptr::null_mut(); }
5011                         CResult_InitDecodeErrorZPtr { err }
5012                 };
5013                 Self {
5014                         contents,
5015                         result_ok: o.result_ok,
5016                 }
5017         }
5018 }
5019 impl Clone for CResult_InitDecodeErrorZ {
5020         fn clone(&self) -> Self {
5021                 if self.result_ok {
5022                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
5023                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
5024                         } }
5025                 } else {
5026                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
5027                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5028                         } }
5029                 }
5030         }
5031 }
5032 #[no_mangle]
5033 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
5034 #[repr(C)]
5035 pub union CResult_OpenChannelDecodeErrorZPtr {
5036         pub result: *mut crate::ln::msgs::OpenChannel,
5037         pub err: *mut crate::ln::msgs::DecodeError,
5038 }
5039 #[repr(C)]
5040 pub struct CResult_OpenChannelDecodeErrorZ {
5041         pub contents: CResult_OpenChannelDecodeErrorZPtr,
5042         pub result_ok: bool,
5043 }
5044 #[no_mangle]
5045 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
5046         CResult_OpenChannelDecodeErrorZ {
5047                 contents: CResult_OpenChannelDecodeErrorZPtr {
5048                         result: Box::into_raw(Box::new(o)),
5049                 },
5050                 result_ok: true,
5051         }
5052 }
5053 #[no_mangle]
5054 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
5055         CResult_OpenChannelDecodeErrorZ {
5056                 contents: CResult_OpenChannelDecodeErrorZPtr {
5057                         err: Box::into_raw(Box::new(e)),
5058                 },
5059                 result_ok: false,
5060         }
5061 }
5062 #[no_mangle]
5063 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
5064 impl Drop for CResult_OpenChannelDecodeErrorZ {
5065         fn drop(&mut self) {
5066                 if self.result_ok {
5067                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5068                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5069                         }
5070                 } else {
5071                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5072                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5073                         }
5074                 }
5075         }
5076 }
5077 impl From<crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
5078         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>) -> Self {
5079                 let contents = if o.result_ok {
5080                         let result = unsafe { o.contents.result };
5081                         unsafe { o.contents.result = std::ptr::null_mut() };
5082                         CResult_OpenChannelDecodeErrorZPtr { result }
5083                 } else {
5084                         let err = unsafe { o.contents.err };
5085                         unsafe { o.contents.err = std::ptr::null_mut(); }
5086                         CResult_OpenChannelDecodeErrorZPtr { err }
5087                 };
5088                 Self {
5089                         contents,
5090                         result_ok: o.result_ok,
5091                 }
5092         }
5093 }
5094 impl Clone for CResult_OpenChannelDecodeErrorZ {
5095         fn clone(&self) -> Self {
5096                 if self.result_ok {
5097                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
5098                                 result: Box::into_raw(Box::new(<crate::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
5099                         } }
5100                 } else {
5101                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
5102                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5103                         } }
5104                 }
5105         }
5106 }
5107 #[no_mangle]
5108 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
5109 #[repr(C)]
5110 pub union CResult_RevokeAndACKDecodeErrorZPtr {
5111         pub result: *mut crate::ln::msgs::RevokeAndACK,
5112         pub err: *mut crate::ln::msgs::DecodeError,
5113 }
5114 #[repr(C)]
5115 pub struct CResult_RevokeAndACKDecodeErrorZ {
5116         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
5117         pub result_ok: bool,
5118 }
5119 #[no_mangle]
5120 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
5121         CResult_RevokeAndACKDecodeErrorZ {
5122                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5123                         result: Box::into_raw(Box::new(o)),
5124                 },
5125                 result_ok: true,
5126         }
5127 }
5128 #[no_mangle]
5129 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
5130         CResult_RevokeAndACKDecodeErrorZ {
5131                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5132                         err: Box::into_raw(Box::new(e)),
5133                 },
5134                 result_ok: false,
5135         }
5136 }
5137 #[no_mangle]
5138 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
5139 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
5140         fn drop(&mut self) {
5141                 if self.result_ok {
5142                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5143                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5144                         }
5145                 } else {
5146                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5147                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5148                         }
5149                 }
5150         }
5151 }
5152 impl From<crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
5153         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>) -> Self {
5154                 let contents = if o.result_ok {
5155                         let result = unsafe { o.contents.result };
5156                         unsafe { o.contents.result = std::ptr::null_mut() };
5157                         CResult_RevokeAndACKDecodeErrorZPtr { result }
5158                 } else {
5159                         let err = unsafe { o.contents.err };
5160                         unsafe { o.contents.err = std::ptr::null_mut(); }
5161                         CResult_RevokeAndACKDecodeErrorZPtr { err }
5162                 };
5163                 Self {
5164                         contents,
5165                         result_ok: o.result_ok,
5166                 }
5167         }
5168 }
5169 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
5170         fn clone(&self) -> Self {
5171                 if self.result_ok {
5172                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
5173                                 result: Box::into_raw(Box::new(<crate::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
5174                         } }
5175                 } else {
5176                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
5177                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5178                         } }
5179                 }
5180         }
5181 }
5182 #[no_mangle]
5183 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
5184 #[repr(C)]
5185 pub union CResult_ShutdownDecodeErrorZPtr {
5186         pub result: *mut crate::ln::msgs::Shutdown,
5187         pub err: *mut crate::ln::msgs::DecodeError,
5188 }
5189 #[repr(C)]
5190 pub struct CResult_ShutdownDecodeErrorZ {
5191         pub contents: CResult_ShutdownDecodeErrorZPtr,
5192         pub result_ok: bool,
5193 }
5194 #[no_mangle]
5195 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
5196         CResult_ShutdownDecodeErrorZ {
5197                 contents: CResult_ShutdownDecodeErrorZPtr {
5198                         result: Box::into_raw(Box::new(o)),
5199                 },
5200                 result_ok: true,
5201         }
5202 }
5203 #[no_mangle]
5204 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
5205         CResult_ShutdownDecodeErrorZ {
5206                 contents: CResult_ShutdownDecodeErrorZPtr {
5207                         err: Box::into_raw(Box::new(e)),
5208                 },
5209                 result_ok: false,
5210         }
5211 }
5212 #[no_mangle]
5213 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
5214 impl Drop for CResult_ShutdownDecodeErrorZ {
5215         fn drop(&mut self) {
5216                 if self.result_ok {
5217                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5218                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5219                         }
5220                 } else {
5221                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5222                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5223                         }
5224                 }
5225         }
5226 }
5227 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
5228         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>) -> Self {
5229                 let contents = if o.result_ok {
5230                         let result = unsafe { o.contents.result };
5231                         unsafe { o.contents.result = std::ptr::null_mut() };
5232                         CResult_ShutdownDecodeErrorZPtr { result }
5233                 } else {
5234                         let err = unsafe { o.contents.err };
5235                         unsafe { o.contents.err = std::ptr::null_mut(); }
5236                         CResult_ShutdownDecodeErrorZPtr { err }
5237                 };
5238                 Self {
5239                         contents,
5240                         result_ok: o.result_ok,
5241                 }
5242         }
5243 }
5244 impl Clone for CResult_ShutdownDecodeErrorZ {
5245         fn clone(&self) -> Self {
5246                 if self.result_ok {
5247                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
5248                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
5249                         } }
5250                 } else {
5251                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
5252                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5253                         } }
5254                 }
5255         }
5256 }
5257 #[no_mangle]
5258 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
5259 #[repr(C)]
5260 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
5261         pub result: *mut crate::ln::msgs::UpdateFailHTLC,
5262         pub err: *mut crate::ln::msgs::DecodeError,
5263 }
5264 #[repr(C)]
5265 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
5266         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
5267         pub result_ok: bool,
5268 }
5269 #[no_mangle]
5270 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
5271         CResult_UpdateFailHTLCDecodeErrorZ {
5272                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5273                         result: Box::into_raw(Box::new(o)),
5274                 },
5275                 result_ok: true,
5276         }
5277 }
5278 #[no_mangle]
5279 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
5280         CResult_UpdateFailHTLCDecodeErrorZ {
5281                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5282                         err: Box::into_raw(Box::new(e)),
5283                 },
5284                 result_ok: false,
5285         }
5286 }
5287 #[no_mangle]
5288 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
5289 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
5290         fn drop(&mut self) {
5291                 if self.result_ok {
5292                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5293                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5294                         }
5295                 } else {
5296                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5297                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5298                         }
5299                 }
5300         }
5301 }
5302 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
5303         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>) -> Self {
5304                 let contents = if o.result_ok {
5305                         let result = unsafe { o.contents.result };
5306                         unsafe { o.contents.result = std::ptr::null_mut() };
5307                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
5308                 } else {
5309                         let err = unsafe { o.contents.err };
5310                         unsafe { o.contents.err = std::ptr::null_mut(); }
5311                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
5312                 };
5313                 Self {
5314                         contents,
5315                         result_ok: o.result_ok,
5316                 }
5317         }
5318 }
5319 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
5320         fn clone(&self) -> Self {
5321                 if self.result_ok {
5322                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5323                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
5324                         } }
5325                 } else {
5326                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5327                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5328                         } }
5329                 }
5330         }
5331 }
5332 #[no_mangle]
5333 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
5334 #[repr(C)]
5335 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5336         pub result: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
5337         pub err: *mut crate::ln::msgs::DecodeError,
5338 }
5339 #[repr(C)]
5340 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5341         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
5342         pub result_ok: bool,
5343 }
5344 #[no_mangle]
5345 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5346         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5347                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5348                         result: Box::into_raw(Box::new(o)),
5349                 },
5350                 result_ok: true,
5351         }
5352 }
5353 #[no_mangle]
5354 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5355         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5356                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5357                         err: Box::into_raw(Box::new(e)),
5358                 },
5359                 result_ok: false,
5360         }
5361 }
5362 #[no_mangle]
5363 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
5364 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5365         fn drop(&mut self) {
5366                 if self.result_ok {
5367                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5368                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5369                         }
5370                 } else {
5371                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5372                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5373                         }
5374                 }
5375         }
5376 }
5377 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5378         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>) -> Self {
5379                 let contents = if o.result_ok {
5380                         let result = unsafe { o.contents.result };
5381                         unsafe { o.contents.result = std::ptr::null_mut() };
5382                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
5383                 } else {
5384                         let err = unsafe { o.contents.err };
5385                         unsafe { o.contents.err = std::ptr::null_mut(); }
5386                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
5387                 };
5388                 Self {
5389                         contents,
5390                         result_ok: o.result_ok,
5391                 }
5392         }
5393 }
5394 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
5395         fn clone(&self) -> Self {
5396                 if self.result_ok {
5397                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5398                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
5399                         } }
5400                 } else {
5401                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5402                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5403                         } }
5404                 }
5405         }
5406 }
5407 #[no_mangle]
5408 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
5409 #[repr(C)]
5410 pub union CResult_UpdateFeeDecodeErrorZPtr {
5411         pub result: *mut crate::ln::msgs::UpdateFee,
5412         pub err: *mut crate::ln::msgs::DecodeError,
5413 }
5414 #[repr(C)]
5415 pub struct CResult_UpdateFeeDecodeErrorZ {
5416         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
5417         pub result_ok: bool,
5418 }
5419 #[no_mangle]
5420 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
5421         CResult_UpdateFeeDecodeErrorZ {
5422                 contents: CResult_UpdateFeeDecodeErrorZPtr {
5423                         result: Box::into_raw(Box::new(o)),
5424                 },
5425                 result_ok: true,
5426         }
5427 }
5428 #[no_mangle]
5429 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
5430         CResult_UpdateFeeDecodeErrorZ {
5431                 contents: CResult_UpdateFeeDecodeErrorZPtr {
5432                         err: Box::into_raw(Box::new(e)),
5433                 },
5434                 result_ok: false,
5435         }
5436 }
5437 #[no_mangle]
5438 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
5439 impl Drop for CResult_UpdateFeeDecodeErrorZ {
5440         fn drop(&mut self) {
5441                 if self.result_ok {
5442                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5443                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5444                         }
5445                 } else {
5446                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5447                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5448                         }
5449                 }
5450         }
5451 }
5452 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
5453         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>) -> Self {
5454                 let contents = if o.result_ok {
5455                         let result = unsafe { o.contents.result };
5456                         unsafe { o.contents.result = std::ptr::null_mut() };
5457                         CResult_UpdateFeeDecodeErrorZPtr { result }
5458                 } else {
5459                         let err = unsafe { o.contents.err };
5460                         unsafe { o.contents.err = std::ptr::null_mut(); }
5461                         CResult_UpdateFeeDecodeErrorZPtr { err }
5462                 };
5463                 Self {
5464                         contents,
5465                         result_ok: o.result_ok,
5466                 }
5467         }
5468 }
5469 impl Clone for CResult_UpdateFeeDecodeErrorZ {
5470         fn clone(&self) -> Self {
5471                 if self.result_ok {
5472                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
5473                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
5474                         } }
5475                 } else {
5476                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
5477                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5478                         } }
5479                 }
5480         }
5481 }
5482 #[no_mangle]
5483 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
5484 #[repr(C)]
5485 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
5486         pub result: *mut crate::ln::msgs::UpdateFulfillHTLC,
5487         pub err: *mut crate::ln::msgs::DecodeError,
5488 }
5489 #[repr(C)]
5490 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
5491         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
5492         pub result_ok: bool,
5493 }
5494 #[no_mangle]
5495 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
5496         CResult_UpdateFulfillHTLCDecodeErrorZ {
5497                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
5498                         result: Box::into_raw(Box::new(o)),
5499                 },
5500                 result_ok: true,
5501         }
5502 }
5503 #[no_mangle]
5504 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
5505         CResult_UpdateFulfillHTLCDecodeErrorZ {
5506                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
5507                         err: Box::into_raw(Box::new(e)),
5508                 },
5509                 result_ok: false,
5510         }
5511 }
5512 #[no_mangle]
5513 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
5514 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
5515         fn drop(&mut self) {
5516                 if self.result_ok {
5517                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5518                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5519                         }
5520                 } else {
5521                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5522                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5523                         }
5524                 }
5525         }
5526 }
5527 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
5528         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>) -> Self {
5529                 let contents = if o.result_ok {
5530                         let result = unsafe { o.contents.result };
5531                         unsafe { o.contents.result = std::ptr::null_mut() };
5532                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
5533                 } else {
5534                         let err = unsafe { o.contents.err };
5535                         unsafe { o.contents.err = std::ptr::null_mut(); }
5536                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
5537                 };
5538                 Self {
5539                         contents,
5540                         result_ok: o.result_ok,
5541                 }
5542         }
5543 }
5544 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
5545         fn clone(&self) -> Self {
5546                 if self.result_ok {
5547                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
5548                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
5549                         } }
5550                 } else {
5551                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
5552                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5553                         } }
5554                 }
5555         }
5556 }
5557 #[no_mangle]
5558 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
5559 #[repr(C)]
5560 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
5561         pub result: *mut crate::ln::msgs::UpdateAddHTLC,
5562         pub err: *mut crate::ln::msgs::DecodeError,
5563 }
5564 #[repr(C)]
5565 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
5566         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
5567         pub result_ok: bool,
5568 }
5569 #[no_mangle]
5570 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
5571         CResult_UpdateAddHTLCDecodeErrorZ {
5572                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
5573                         result: Box::into_raw(Box::new(o)),
5574                 },
5575                 result_ok: true,
5576         }
5577 }
5578 #[no_mangle]
5579 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
5580         CResult_UpdateAddHTLCDecodeErrorZ {
5581                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
5582                         err: Box::into_raw(Box::new(e)),
5583                 },
5584                 result_ok: false,
5585         }
5586 }
5587 #[no_mangle]
5588 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
5589 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
5590         fn drop(&mut self) {
5591                 if self.result_ok {
5592                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5593                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5594                         }
5595                 } else {
5596                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5597                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5598                         }
5599                 }
5600         }
5601 }
5602 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
5603         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>) -> Self {
5604                 let contents = if o.result_ok {
5605                         let result = unsafe { o.contents.result };
5606                         unsafe { o.contents.result = std::ptr::null_mut() };
5607                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
5608                 } else {
5609                         let err = unsafe { o.contents.err };
5610                         unsafe { o.contents.err = std::ptr::null_mut(); }
5611                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
5612                 };
5613                 Self {
5614                         contents,
5615                         result_ok: o.result_ok,
5616                 }
5617         }
5618 }
5619 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
5620         fn clone(&self) -> Self {
5621                 if self.result_ok {
5622                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
5623                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
5624                         } }
5625                 } else {
5626                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
5627                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5628                         } }
5629                 }
5630         }
5631 }
5632 #[no_mangle]
5633 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
5634 #[repr(C)]
5635 pub union CResult_PingDecodeErrorZPtr {
5636         pub result: *mut crate::ln::msgs::Ping,
5637         pub err: *mut crate::ln::msgs::DecodeError,
5638 }
5639 #[repr(C)]
5640 pub struct CResult_PingDecodeErrorZ {
5641         pub contents: CResult_PingDecodeErrorZPtr,
5642         pub result_ok: bool,
5643 }
5644 #[no_mangle]
5645 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
5646         CResult_PingDecodeErrorZ {
5647                 contents: CResult_PingDecodeErrorZPtr {
5648                         result: Box::into_raw(Box::new(o)),
5649                 },
5650                 result_ok: true,
5651         }
5652 }
5653 #[no_mangle]
5654 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
5655         CResult_PingDecodeErrorZ {
5656                 contents: CResult_PingDecodeErrorZPtr {
5657                         err: Box::into_raw(Box::new(e)),
5658                 },
5659                 result_ok: false,
5660         }
5661 }
5662 #[no_mangle]
5663 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
5664 impl Drop for CResult_PingDecodeErrorZ {
5665         fn drop(&mut self) {
5666                 if self.result_ok {
5667                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5668                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5669                         }
5670                 } else {
5671                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5672                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5673                         }
5674                 }
5675         }
5676 }
5677 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
5678         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
5679                 let contents = if o.result_ok {
5680                         let result = unsafe { o.contents.result };
5681                         unsafe { o.contents.result = std::ptr::null_mut() };
5682                         CResult_PingDecodeErrorZPtr { result }
5683                 } else {
5684                         let err = unsafe { o.contents.err };
5685                         unsafe { o.contents.err = std::ptr::null_mut(); }
5686                         CResult_PingDecodeErrorZPtr { err }
5687                 };
5688                 Self {
5689                         contents,
5690                         result_ok: o.result_ok,
5691                 }
5692         }
5693 }
5694 impl Clone for CResult_PingDecodeErrorZ {
5695         fn clone(&self) -> Self {
5696                 if self.result_ok {
5697                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
5698                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
5699                         } }
5700                 } else {
5701                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
5702                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5703                         } }
5704                 }
5705         }
5706 }
5707 #[no_mangle]
5708 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
5709 #[repr(C)]
5710 pub union CResult_PongDecodeErrorZPtr {
5711         pub result: *mut crate::ln::msgs::Pong,
5712         pub err: *mut crate::ln::msgs::DecodeError,
5713 }
5714 #[repr(C)]
5715 pub struct CResult_PongDecodeErrorZ {
5716         pub contents: CResult_PongDecodeErrorZPtr,
5717         pub result_ok: bool,
5718 }
5719 #[no_mangle]
5720 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
5721         CResult_PongDecodeErrorZ {
5722                 contents: CResult_PongDecodeErrorZPtr {
5723                         result: Box::into_raw(Box::new(o)),
5724                 },
5725                 result_ok: true,
5726         }
5727 }
5728 #[no_mangle]
5729 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
5730         CResult_PongDecodeErrorZ {
5731                 contents: CResult_PongDecodeErrorZPtr {
5732                         err: Box::into_raw(Box::new(e)),
5733                 },
5734                 result_ok: false,
5735         }
5736 }
5737 #[no_mangle]
5738 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
5739 impl Drop for CResult_PongDecodeErrorZ {
5740         fn drop(&mut self) {
5741                 if self.result_ok {
5742                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5743                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5744                         }
5745                 } else {
5746                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5747                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5748                         }
5749                 }
5750         }
5751 }
5752 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
5753         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
5754                 let contents = if o.result_ok {
5755                         let result = unsafe { o.contents.result };
5756                         unsafe { o.contents.result = std::ptr::null_mut() };
5757                         CResult_PongDecodeErrorZPtr { result }
5758                 } else {
5759                         let err = unsafe { o.contents.err };
5760                         unsafe { o.contents.err = std::ptr::null_mut(); }
5761                         CResult_PongDecodeErrorZPtr { err }
5762                 };
5763                 Self {
5764                         contents,
5765                         result_ok: o.result_ok,
5766                 }
5767         }
5768 }
5769 impl Clone for CResult_PongDecodeErrorZ {
5770         fn clone(&self) -> Self {
5771                 if self.result_ok {
5772                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
5773                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
5774                         } }
5775                 } else {
5776                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
5777                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5778                         } }
5779                 }
5780         }
5781 }
5782 #[no_mangle]
5783 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
5784 #[repr(C)]
5785 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
5786         pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
5787         pub err: *mut crate::ln::msgs::DecodeError,
5788 }
5789 #[repr(C)]
5790 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5791         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
5792         pub result_ok: bool,
5793 }
5794 #[no_mangle]
5795 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5796         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5797                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
5798                         result: Box::into_raw(Box::new(o)),
5799                 },
5800                 result_ok: true,
5801         }
5802 }
5803 #[no_mangle]
5804 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5805         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5806                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
5807                         err: Box::into_raw(Box::new(e)),
5808                 },
5809                 result_ok: false,
5810         }
5811 }
5812 #[no_mangle]
5813 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
5814 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5815         fn drop(&mut self) {
5816                 if self.result_ok {
5817                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5818                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5819                         }
5820                 } else {
5821                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5822                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5823                         }
5824                 }
5825         }
5826 }
5827 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5828         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
5829                 let contents = if o.result_ok {
5830                         let result = unsafe { o.contents.result };
5831                         unsafe { o.contents.result = std::ptr::null_mut() };
5832                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
5833                 } else {
5834                         let err = unsafe { o.contents.err };
5835                         unsafe { o.contents.err = std::ptr::null_mut(); }
5836                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
5837                 };
5838                 Self {
5839                         contents,
5840                         result_ok: o.result_ok,
5841                 }
5842         }
5843 }
5844 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
5845         fn clone(&self) -> Self {
5846                 if self.result_ok {
5847                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
5848                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
5849                         } }
5850                 } else {
5851                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
5852                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5853                         } }
5854                 }
5855         }
5856 }
5857 #[no_mangle]
5858 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
5859 #[repr(C)]
5860 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
5861         pub result: *mut crate::ln::msgs::ChannelAnnouncement,
5862         pub err: *mut crate::ln::msgs::DecodeError,
5863 }
5864 #[repr(C)]
5865 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
5866         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
5867         pub result_ok: bool,
5868 }
5869 #[no_mangle]
5870 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
5871         CResult_ChannelAnnouncementDecodeErrorZ {
5872                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
5873                         result: Box::into_raw(Box::new(o)),
5874                 },
5875                 result_ok: true,
5876         }
5877 }
5878 #[no_mangle]
5879 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
5880         CResult_ChannelAnnouncementDecodeErrorZ {
5881                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
5882                         err: Box::into_raw(Box::new(e)),
5883                 },
5884                 result_ok: false,
5885         }
5886 }
5887 #[no_mangle]
5888 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
5889 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
5890         fn drop(&mut self) {
5891                 if self.result_ok {
5892                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5893                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5894                         }
5895                 } else {
5896                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5897                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5898                         }
5899                 }
5900         }
5901 }
5902 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
5903         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
5904                 let contents = if o.result_ok {
5905                         let result = unsafe { o.contents.result };
5906                         unsafe { o.contents.result = std::ptr::null_mut() };
5907                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
5908                 } else {
5909                         let err = unsafe { o.contents.err };
5910                         unsafe { o.contents.err = std::ptr::null_mut(); }
5911                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
5912                 };
5913                 Self {
5914                         contents,
5915                         result_ok: o.result_ok,
5916                 }
5917         }
5918 }
5919 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
5920         fn clone(&self) -> Self {
5921                 if self.result_ok {
5922                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
5923                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
5924                         } }
5925                 } else {
5926                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
5927                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5928                         } }
5929                 }
5930         }
5931 }
5932 #[no_mangle]
5933 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
5934 #[repr(C)]
5935 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
5936         pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
5937         pub err: *mut crate::ln::msgs::DecodeError,
5938 }
5939 #[repr(C)]
5940 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
5941         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
5942         pub result_ok: bool,
5943 }
5944 #[no_mangle]
5945 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
5946         CResult_UnsignedChannelUpdateDecodeErrorZ {
5947                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
5948                         result: Box::into_raw(Box::new(o)),
5949                 },
5950                 result_ok: true,
5951         }
5952 }
5953 #[no_mangle]
5954 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
5955         CResult_UnsignedChannelUpdateDecodeErrorZ {
5956                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
5957                         err: Box::into_raw(Box::new(e)),
5958                 },
5959                 result_ok: false,
5960         }
5961 }
5962 #[no_mangle]
5963 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
5964 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
5965         fn drop(&mut self) {
5966                 if self.result_ok {
5967                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5968                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5969                         }
5970                 } else {
5971                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5972                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5973                         }
5974                 }
5975         }
5976 }
5977 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
5978         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
5979                 let contents = if o.result_ok {
5980                         let result = unsafe { o.contents.result };
5981                         unsafe { o.contents.result = std::ptr::null_mut() };
5982                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
5983                 } else {
5984                         let err = unsafe { o.contents.err };
5985                         unsafe { o.contents.err = std::ptr::null_mut(); }
5986                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
5987                 };
5988                 Self {
5989                         contents,
5990                         result_ok: o.result_ok,
5991                 }
5992         }
5993 }
5994 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
5995         fn clone(&self) -> Self {
5996                 if self.result_ok {
5997                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
5998                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
5999                         } }
6000                 } else {
6001                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6002                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6003                         } }
6004                 }
6005         }
6006 }
6007 #[no_mangle]
6008 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
6009 #[repr(C)]
6010 pub union CResult_ChannelUpdateDecodeErrorZPtr {
6011         pub result: *mut crate::ln::msgs::ChannelUpdate,
6012         pub err: *mut crate::ln::msgs::DecodeError,
6013 }
6014 #[repr(C)]
6015 pub struct CResult_ChannelUpdateDecodeErrorZ {
6016         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
6017         pub result_ok: bool,
6018 }
6019 #[no_mangle]
6020 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
6021         CResult_ChannelUpdateDecodeErrorZ {
6022                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
6023                         result: Box::into_raw(Box::new(o)),
6024                 },
6025                 result_ok: true,
6026         }
6027 }
6028 #[no_mangle]
6029 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
6030         CResult_ChannelUpdateDecodeErrorZ {
6031                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
6032                         err: Box::into_raw(Box::new(e)),
6033                 },
6034                 result_ok: false,
6035         }
6036 }
6037 #[no_mangle]
6038 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
6039 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
6040         fn drop(&mut self) {
6041                 if self.result_ok {
6042                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6043                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6044                         }
6045                 } else {
6046                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6047                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6048                         }
6049                 }
6050         }
6051 }
6052 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
6053         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
6054                 let contents = if o.result_ok {
6055                         let result = unsafe { o.contents.result };
6056                         unsafe { o.contents.result = std::ptr::null_mut() };
6057                         CResult_ChannelUpdateDecodeErrorZPtr { result }
6058                 } else {
6059                         let err = unsafe { o.contents.err };
6060                         unsafe { o.contents.err = std::ptr::null_mut(); }
6061                         CResult_ChannelUpdateDecodeErrorZPtr { err }
6062                 };
6063                 Self {
6064                         contents,
6065                         result_ok: o.result_ok,
6066                 }
6067         }
6068 }
6069 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
6070         fn clone(&self) -> Self {
6071                 if self.result_ok {
6072                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
6073                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
6074                         } }
6075                 } else {
6076                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
6077                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6078                         } }
6079                 }
6080         }
6081 }
6082 #[no_mangle]
6083 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
6084 #[repr(C)]
6085 pub union CResult_ErrorMessageDecodeErrorZPtr {
6086         pub result: *mut crate::ln::msgs::ErrorMessage,
6087         pub err: *mut crate::ln::msgs::DecodeError,
6088 }
6089 #[repr(C)]
6090 pub struct CResult_ErrorMessageDecodeErrorZ {
6091         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
6092         pub result_ok: bool,
6093 }
6094 #[no_mangle]
6095 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
6096         CResult_ErrorMessageDecodeErrorZ {
6097                 contents: CResult_ErrorMessageDecodeErrorZPtr {
6098                         result: Box::into_raw(Box::new(o)),
6099                 },
6100                 result_ok: true,
6101         }
6102 }
6103 #[no_mangle]
6104 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
6105         CResult_ErrorMessageDecodeErrorZ {
6106                 contents: CResult_ErrorMessageDecodeErrorZPtr {
6107                         err: Box::into_raw(Box::new(e)),
6108                 },
6109                 result_ok: false,
6110         }
6111 }
6112 #[no_mangle]
6113 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
6114 impl Drop for CResult_ErrorMessageDecodeErrorZ {
6115         fn drop(&mut self) {
6116                 if self.result_ok {
6117                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6118                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6119                         }
6120                 } else {
6121                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6122                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6123                         }
6124                 }
6125         }
6126 }
6127 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
6128         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
6129                 let contents = if o.result_ok {
6130                         let result = unsafe { o.contents.result };
6131                         unsafe { o.contents.result = std::ptr::null_mut() };
6132                         CResult_ErrorMessageDecodeErrorZPtr { result }
6133                 } else {
6134                         let err = unsafe { o.contents.err };
6135                         unsafe { o.contents.err = std::ptr::null_mut(); }
6136                         CResult_ErrorMessageDecodeErrorZPtr { err }
6137                 };
6138                 Self {
6139                         contents,
6140                         result_ok: o.result_ok,
6141                 }
6142         }
6143 }
6144 impl Clone for CResult_ErrorMessageDecodeErrorZ {
6145         fn clone(&self) -> Self {
6146                 if self.result_ok {
6147                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
6148                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
6149                         } }
6150                 } else {
6151                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
6152                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6153                         } }
6154                 }
6155         }
6156 }
6157 #[no_mangle]
6158 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
6159 #[repr(C)]
6160 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6161         pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
6162         pub err: *mut crate::ln::msgs::DecodeError,
6163 }
6164 #[repr(C)]
6165 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6166         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
6167         pub result_ok: bool,
6168 }
6169 #[no_mangle]
6170 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6171         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6172                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6173                         result: Box::into_raw(Box::new(o)),
6174                 },
6175                 result_ok: true,
6176         }
6177 }
6178 #[no_mangle]
6179 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6180         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6181                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6182                         err: Box::into_raw(Box::new(e)),
6183                 },
6184                 result_ok: false,
6185         }
6186 }
6187 #[no_mangle]
6188 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
6189 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6190         fn drop(&mut self) {
6191                 if self.result_ok {
6192                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6193                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6194                         }
6195                 } else {
6196                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6197                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6198                         }
6199                 }
6200         }
6201 }
6202 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6203         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6204                 let contents = if o.result_ok {
6205                         let result = unsafe { o.contents.result };
6206                         unsafe { o.contents.result = std::ptr::null_mut() };
6207                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
6208                 } else {
6209                         let err = unsafe { o.contents.err };
6210                         unsafe { o.contents.err = std::ptr::null_mut(); }
6211                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
6212                 };
6213                 Self {
6214                         contents,
6215                         result_ok: o.result_ok,
6216                 }
6217         }
6218 }
6219 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6220         fn clone(&self) -> Self {
6221                 if self.result_ok {
6222                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6223                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
6224                         } }
6225                 } else {
6226                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6227                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6228                         } }
6229                 }
6230         }
6231 }
6232 #[no_mangle]
6233 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
6234 #[repr(C)]
6235 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
6236         pub result: *mut crate::ln::msgs::NodeAnnouncement,
6237         pub err: *mut crate::ln::msgs::DecodeError,
6238 }
6239 #[repr(C)]
6240 pub struct CResult_NodeAnnouncementDecodeErrorZ {
6241         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
6242         pub result_ok: bool,
6243 }
6244 #[no_mangle]
6245 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
6246         CResult_NodeAnnouncementDecodeErrorZ {
6247                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6248                         result: Box::into_raw(Box::new(o)),
6249                 },
6250                 result_ok: true,
6251         }
6252 }
6253 #[no_mangle]
6254 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
6255         CResult_NodeAnnouncementDecodeErrorZ {
6256                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6257                         err: Box::into_raw(Box::new(e)),
6258                 },
6259                 result_ok: false,
6260         }
6261 }
6262 #[no_mangle]
6263 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
6264 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
6265         fn drop(&mut self) {
6266                 if self.result_ok {
6267                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6268                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6269                         }
6270                 } else {
6271                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6272                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6273                         }
6274                 }
6275         }
6276 }
6277 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
6278         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6279                 let contents = if o.result_ok {
6280                         let result = unsafe { o.contents.result };
6281                         unsafe { o.contents.result = std::ptr::null_mut() };
6282                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
6283                 } else {
6284                         let err = unsafe { o.contents.err };
6285                         unsafe { o.contents.err = std::ptr::null_mut(); }
6286                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
6287                 };
6288                 Self {
6289                         contents,
6290                         result_ok: o.result_ok,
6291                 }
6292         }
6293 }
6294 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
6295         fn clone(&self) -> Self {
6296                 if self.result_ok {
6297                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6298                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
6299                         } }
6300                 } else {
6301                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6302                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6303                         } }
6304                 }
6305         }
6306 }
6307 #[no_mangle]
6308 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
6309 #[repr(C)]
6310 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
6311         pub result: *mut crate::ln::msgs::QueryShortChannelIds,
6312         pub err: *mut crate::ln::msgs::DecodeError,
6313 }
6314 #[repr(C)]
6315 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
6316         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
6317         pub result_ok: bool,
6318 }
6319 #[no_mangle]
6320 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
6321         CResult_QueryShortChannelIdsDecodeErrorZ {
6322                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6323                         result: Box::into_raw(Box::new(o)),
6324                 },
6325                 result_ok: true,
6326         }
6327 }
6328 #[no_mangle]
6329 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
6330         CResult_QueryShortChannelIdsDecodeErrorZ {
6331                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6332                         err: Box::into_raw(Box::new(e)),
6333                 },
6334                 result_ok: false,
6335         }
6336 }
6337 #[no_mangle]
6338 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
6339 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
6340         fn drop(&mut self) {
6341                 if self.result_ok {
6342                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6343                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6344                         }
6345                 } else {
6346                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6347                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6348                         }
6349                 }
6350         }
6351 }
6352 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
6353         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
6354                 let contents = if o.result_ok {
6355                         let result = unsafe { o.contents.result };
6356                         unsafe { o.contents.result = std::ptr::null_mut() };
6357                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
6358                 } else {
6359                         let err = unsafe { o.contents.err };
6360                         unsafe { o.contents.err = std::ptr::null_mut(); }
6361                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
6362                 };
6363                 Self {
6364                         contents,
6365                         result_ok: o.result_ok,
6366                 }
6367         }
6368 }
6369 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
6370         fn clone(&self) -> Self {
6371                 if self.result_ok {
6372                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6373                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
6374                         } }
6375                 } else {
6376                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6377                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6378                         } }
6379                 }
6380         }
6381 }
6382 #[no_mangle]
6383 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
6384 #[repr(C)]
6385 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6386         pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
6387         pub err: *mut crate::ln::msgs::DecodeError,
6388 }
6389 #[repr(C)]
6390 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6391         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
6392         pub result_ok: bool,
6393 }
6394 #[no_mangle]
6395 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6396         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6397                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6398                         result: Box::into_raw(Box::new(o)),
6399                 },
6400                 result_ok: true,
6401         }
6402 }
6403 #[no_mangle]
6404 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6405         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6406                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6407                         err: Box::into_raw(Box::new(e)),
6408                 },
6409                 result_ok: false,
6410         }
6411 }
6412 #[no_mangle]
6413 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
6414 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6415         fn drop(&mut self) {
6416                 if self.result_ok {
6417                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6418                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6419                         }
6420                 } else {
6421                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6422                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6423                         }
6424                 }
6425         }
6426 }
6427 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6428         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
6429                 let contents = if o.result_ok {
6430                         let result = unsafe { o.contents.result };
6431                         unsafe { o.contents.result = std::ptr::null_mut() };
6432                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
6433                 } else {
6434                         let err = unsafe { o.contents.err };
6435                         unsafe { o.contents.err = std::ptr::null_mut(); }
6436                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
6437                 };
6438                 Self {
6439                         contents,
6440                         result_ok: o.result_ok,
6441                 }
6442         }
6443 }
6444 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
6445         fn clone(&self) -> Self {
6446                 if self.result_ok {
6447                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6448                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
6449                         } }
6450                 } else {
6451                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
6452                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6453                         } }
6454                 }
6455         }
6456 }
6457 #[no_mangle]
6458 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
6459 #[repr(C)]
6460 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
6461         pub result: *mut crate::ln::msgs::QueryChannelRange,
6462         pub err: *mut crate::ln::msgs::DecodeError,
6463 }
6464 #[repr(C)]
6465 pub struct CResult_QueryChannelRangeDecodeErrorZ {
6466         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
6467         pub result_ok: bool,
6468 }
6469 #[no_mangle]
6470 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
6471         CResult_QueryChannelRangeDecodeErrorZ {
6472                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
6473                         result: Box::into_raw(Box::new(o)),
6474                 },
6475                 result_ok: true,
6476         }
6477 }
6478 #[no_mangle]
6479 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
6480         CResult_QueryChannelRangeDecodeErrorZ {
6481                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
6482                         err: Box::into_raw(Box::new(e)),
6483                 },
6484                 result_ok: false,
6485         }
6486 }
6487 #[no_mangle]
6488 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
6489 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
6490         fn drop(&mut self) {
6491                 if self.result_ok {
6492                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6493                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6494                         }
6495                 } else {
6496                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6497                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6498                         }
6499                 }
6500         }
6501 }
6502 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
6503         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
6504                 let contents = if o.result_ok {
6505                         let result = unsafe { o.contents.result };
6506                         unsafe { o.contents.result = std::ptr::null_mut() };
6507                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
6508                 } else {
6509                         let err = unsafe { o.contents.err };
6510                         unsafe { o.contents.err = std::ptr::null_mut(); }
6511                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
6512                 };
6513                 Self {
6514                         contents,
6515                         result_ok: o.result_ok,
6516                 }
6517         }
6518 }
6519 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
6520         fn clone(&self) -> Self {
6521                 if self.result_ok {
6522                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
6523                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
6524                         } }
6525                 } else {
6526                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
6527                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6528                         } }
6529                 }
6530         }
6531 }
6532 #[no_mangle]
6533 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
6534 #[repr(C)]
6535 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
6536         pub result: *mut crate::ln::msgs::ReplyChannelRange,
6537         pub err: *mut crate::ln::msgs::DecodeError,
6538 }
6539 #[repr(C)]
6540 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
6541         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
6542         pub result_ok: bool,
6543 }
6544 #[no_mangle]
6545 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
6546         CResult_ReplyChannelRangeDecodeErrorZ {
6547                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
6548                         result: Box::into_raw(Box::new(o)),
6549                 },
6550                 result_ok: true,
6551         }
6552 }
6553 #[no_mangle]
6554 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
6555         CResult_ReplyChannelRangeDecodeErrorZ {
6556                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
6557                         err: Box::into_raw(Box::new(e)),
6558                 },
6559                 result_ok: false,
6560         }
6561 }
6562 #[no_mangle]
6563 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
6564 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
6565         fn drop(&mut self) {
6566                 if self.result_ok {
6567                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6568                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6569                         }
6570                 } else {
6571                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6572                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6573                         }
6574                 }
6575         }
6576 }
6577 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
6578         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
6579                 let contents = if o.result_ok {
6580                         let result = unsafe { o.contents.result };
6581                         unsafe { o.contents.result = std::ptr::null_mut() };
6582                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
6583                 } else {
6584                         let err = unsafe { o.contents.err };
6585                         unsafe { o.contents.err = std::ptr::null_mut(); }
6586                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
6587                 };
6588                 Self {
6589                         contents,
6590                         result_ok: o.result_ok,
6591                 }
6592         }
6593 }
6594 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
6595         fn clone(&self) -> Self {
6596                 if self.result_ok {
6597                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
6598                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
6599                         } }
6600                 } else {
6601                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
6602                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6603                         } }
6604                 }
6605         }
6606 }
6607 #[no_mangle]
6608 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
6609 #[repr(C)]
6610 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
6611         pub result: *mut crate::ln::msgs::GossipTimestampFilter,
6612         pub err: *mut crate::ln::msgs::DecodeError,
6613 }
6614 #[repr(C)]
6615 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
6616         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
6617         pub result_ok: bool,
6618 }
6619 #[no_mangle]
6620 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
6621         CResult_GossipTimestampFilterDecodeErrorZ {
6622                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
6623                         result: Box::into_raw(Box::new(o)),
6624                 },
6625                 result_ok: true,
6626         }
6627 }
6628 #[no_mangle]
6629 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
6630         CResult_GossipTimestampFilterDecodeErrorZ {
6631                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
6632                         err: Box::into_raw(Box::new(e)),
6633                 },
6634                 result_ok: false,
6635         }
6636 }
6637 #[no_mangle]
6638 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
6639 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
6640         fn drop(&mut self) {
6641                 if self.result_ok {
6642                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6643                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6644                         }
6645                 } else {
6646                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6647                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6648                         }
6649                 }
6650         }
6651 }
6652 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
6653         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
6654                 let contents = if o.result_ok {
6655                         let result = unsafe { o.contents.result };
6656                         unsafe { o.contents.result = std::ptr::null_mut() };
6657                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
6658                 } else {
6659                         let err = unsafe { o.contents.err };
6660                         unsafe { o.contents.err = std::ptr::null_mut(); }
6661                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
6662                 };
6663                 Self {
6664                         contents,
6665                         result_ok: o.result_ok,
6666                 }
6667         }
6668 }
6669 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
6670         fn clone(&self) -> Self {
6671                 if self.result_ok {
6672                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
6673                                 result: Box::into_raw(Box::new(<crate::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
6674                         } }
6675                 } else {
6676                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
6677                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6678                         } }
6679                 }
6680         }
6681 }
6682 #[no_mangle]
6683 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }