Update auto-generated bindings to current upstream
[ldk-c-bindings] / 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_MessageSendEventZ {
954         pub data: *mut crate::util::events::MessageSendEvent,
955         pub datalen: usize
956 }
957 impl CVec_MessageSendEventZ {
958         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::MessageSendEvent> {
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::util::events::MessageSendEvent] {
966                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
967         }
968 }
969 impl From<Vec<crate::util::events::MessageSendEvent>> for CVec_MessageSendEventZ {
970         fn from(v: Vec<crate::util::events::MessageSendEvent>) -> 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_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { }
978 impl Drop for CVec_MessageSendEventZ {
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 impl Clone for CVec_MessageSendEventZ {
985         fn clone(&self) -> Self {
986                 let mut res = Vec::new();
987                 if self.datalen == 0 { return Self::from(res); }
988                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
989                 Self::from(res)
990         }
991 }
992 #[repr(C)]
993 pub union CResult_boolLightningErrorZPtr {
994         pub result: *mut bool,
995         pub err: *mut crate::ln::msgs::LightningError,
996 }
997 #[repr(C)]
998 pub struct CResult_boolLightningErrorZ {
999         pub contents: CResult_boolLightningErrorZPtr,
1000         pub result_ok: bool,
1001 }
1002 #[no_mangle]
1003 pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ {
1004         CResult_boolLightningErrorZ {
1005                 contents: CResult_boolLightningErrorZPtr {
1006                         result: Box::into_raw(Box::new(o)),
1007                 },
1008                 result_ok: true,
1009         }
1010 }
1011 #[no_mangle]
1012 pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_boolLightningErrorZ {
1013         CResult_boolLightningErrorZ {
1014                 contents: CResult_boolLightningErrorZPtr {
1015                         err: Box::into_raw(Box::new(e)),
1016                 },
1017                 result_ok: false,
1018         }
1019 }
1020 #[no_mangle]
1021 pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { }
1022 impl Drop for CResult_boolLightningErrorZ {
1023         fn drop(&mut self) {
1024                 if self.result_ok {
1025                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1026                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1027                         }
1028                 } else {
1029                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1030                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1031                         }
1032                 }
1033         }
1034 }
1035 impl From<crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>> for CResult_boolLightningErrorZ {
1036         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::msgs::LightningError>) -> Self {
1037                 let contents = if o.result_ok {
1038                         let result = unsafe { o.contents.result };
1039                         unsafe { o.contents.result = std::ptr::null_mut() };
1040                         CResult_boolLightningErrorZPtr { result }
1041                 } else {
1042                         let err = unsafe { o.contents.err };
1043                         unsafe { o.contents.err = std::ptr::null_mut(); }
1044                         CResult_boolLightningErrorZPtr { err }
1045                 };
1046                 Self {
1047                         contents,
1048                         result_ok: o.result_ok,
1049                 }
1050         }
1051 }
1052 impl Clone for CResult_boolLightningErrorZ {
1053         fn clone(&self) -> Self {
1054                 if self.result_ok {
1055                         Self { result_ok: true, contents: CResult_boolLightningErrorZPtr {
1056                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
1057                         } }
1058                 } else {
1059                         Self { result_ok: false, contents: CResult_boolLightningErrorZPtr {
1060                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1061                         } }
1062                 }
1063         }
1064 }
1065 #[no_mangle]
1066 pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { orig.clone() }
1067 #[repr(C)]
1068 pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1069         pub a: crate::ln::msgs::ChannelAnnouncement,
1070         pub b: crate::ln::msgs::ChannelUpdate,
1071         pub c: crate::ln::msgs::ChannelUpdate,
1072 }
1073 impl From<(crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1074         fn from (tup: (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate)) -> Self {
1075                 Self {
1076                         a: tup.0,
1077                         b: tup.1,
1078                         c: tup.2,
1079                 }
1080         }
1081 }
1082 impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1083         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::ChannelUpdate, crate::ln::msgs::ChannelUpdate) {
1084                 (self.a, self.b, self.c)
1085         }
1086 }
1087 impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1088         fn clone(&self) -> Self {
1089                 Self {
1090                         a: self.a.clone(),
1091                         b: self.b.clone(),
1092                         c: self.c.clone(),
1093                 }
1094         }
1095 }
1096 #[no_mangle]
1097 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { orig.clone() }
1098 #[no_mangle]
1099 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::ln::msgs::ChannelAnnouncement, b: crate::ln::msgs::ChannelUpdate, c: crate::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
1100         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, }
1101 }
1102
1103 #[no_mangle]
1104 pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { }
1105 #[repr(C)]
1106 pub struct CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1107         pub data: *mut crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ,
1108         pub datalen: usize
1109 }
1110 impl CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1111         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ> {
1112                 if self.datalen == 0 { return Vec::new(); }
1113                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1114                 self.data = std::ptr::null_mut();
1115                 self.datalen = 0;
1116                 ret
1117         }
1118         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ] {
1119                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1120         }
1121 }
1122 impl From<Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>> for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1123         fn from(v: Vec<crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ>) -> Self {
1124                 let datalen = v.len();
1125                 let data = Box::into_raw(v.into_boxed_slice());
1126                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1127         }
1128 }
1129 #[no_mangle]
1130 pub extern "C" fn CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { }
1131 impl Drop for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1132         fn drop(&mut self) {
1133                 if self.datalen == 0 { return; }
1134                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1135         }
1136 }
1137 impl Clone for CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
1138         fn clone(&self) -> Self {
1139                 let mut res = Vec::new();
1140                 if self.datalen == 0 { return Self::from(res); }
1141                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1142                 Self::from(res)
1143         }
1144 }
1145 #[repr(C)]
1146 pub struct CVec_NodeAnnouncementZ {
1147         pub data: *mut crate::ln::msgs::NodeAnnouncement,
1148         pub datalen: usize
1149 }
1150 impl CVec_NodeAnnouncementZ {
1151         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NodeAnnouncement> {
1152                 if self.datalen == 0 { return Vec::new(); }
1153                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1154                 self.data = std::ptr::null_mut();
1155                 self.datalen = 0;
1156                 ret
1157         }
1158         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NodeAnnouncement] {
1159                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1160         }
1161 }
1162 impl From<Vec<crate::ln::msgs::NodeAnnouncement>> for CVec_NodeAnnouncementZ {
1163         fn from(v: Vec<crate::ln::msgs::NodeAnnouncement>) -> Self {
1164                 let datalen = v.len();
1165                 let data = Box::into_raw(v.into_boxed_slice());
1166                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1167         }
1168 }
1169 #[no_mangle]
1170 pub extern "C" fn CVec_NodeAnnouncementZ_free(_res: CVec_NodeAnnouncementZ) { }
1171 impl Drop for CVec_NodeAnnouncementZ {
1172         fn drop(&mut self) {
1173                 if self.datalen == 0 { return; }
1174                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1175         }
1176 }
1177 impl Clone for CVec_NodeAnnouncementZ {
1178         fn clone(&self) -> Self {
1179                 let mut res = Vec::new();
1180                 if self.datalen == 0 { return Self::from(res); }
1181                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1182                 Self::from(res)
1183         }
1184 }
1185 #[repr(C)]
1186 pub union CResult_NoneLightningErrorZPtr {
1187         /// Note that this value is always NULL, as there are no contents in the OK variant
1188         pub result: *mut std::ffi::c_void,
1189         pub err: *mut crate::ln::msgs::LightningError,
1190 }
1191 #[repr(C)]
1192 pub struct CResult_NoneLightningErrorZ {
1193         pub contents: CResult_NoneLightningErrorZPtr,
1194         pub result_ok: bool,
1195 }
1196 #[no_mangle]
1197 pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ {
1198         CResult_NoneLightningErrorZ {
1199                 contents: CResult_NoneLightningErrorZPtr {
1200                         result: std::ptr::null_mut(),
1201                 },
1202                 result_ok: true,
1203         }
1204 }
1205 #[no_mangle]
1206 pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ {
1207         CResult_NoneLightningErrorZ {
1208                 contents: CResult_NoneLightningErrorZPtr {
1209                         err: Box::into_raw(Box::new(e)),
1210                 },
1211                 result_ok: false,
1212         }
1213 }
1214 #[no_mangle]
1215 pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { }
1216 impl Drop for CResult_NoneLightningErrorZ {
1217         fn drop(&mut self) {
1218                 if self.result_ok {
1219                 } else {
1220                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1221                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1222                         }
1223                 }
1224         }
1225 }
1226 impl From<crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>> for CResult_NoneLightningErrorZ {
1227         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::msgs::LightningError>) -> Self {
1228                 let contents = if o.result_ok {
1229                         let _ = unsafe { Box::from_raw(o.contents.result) };
1230                         o.contents.result = std::ptr::null_mut();
1231                         CResult_NoneLightningErrorZPtr { result: std::ptr::null_mut() }
1232                 } else {
1233                         let err = unsafe { o.contents.err };
1234                         unsafe { o.contents.err = std::ptr::null_mut(); }
1235                         CResult_NoneLightningErrorZPtr { err }
1236                 };
1237                 Self {
1238                         contents,
1239                         result_ok: o.result_ok,
1240                 }
1241         }
1242 }
1243 impl Clone for CResult_NoneLightningErrorZ {
1244         fn clone(&self) -> Self {
1245                 if self.result_ok {
1246                         Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr {
1247                                 result: std::ptr::null_mut()
1248                         } }
1249                 } else {
1250                         Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr {
1251                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
1252                         } }
1253                 }
1254         }
1255 }
1256 #[no_mangle]
1257 pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { orig.clone() }
1258 #[repr(C)]
1259 pub struct CVec_PublicKeyZ {
1260         pub data: *mut crate::c_types::PublicKey,
1261         pub datalen: usize
1262 }
1263 impl CVec_PublicKeyZ {
1264         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::PublicKey> {
1265                 if self.datalen == 0 { return Vec::new(); }
1266                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1267                 self.data = std::ptr::null_mut();
1268                 self.datalen = 0;
1269                 ret
1270         }
1271         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] {
1272                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1273         }
1274 }
1275 impl From<Vec<crate::c_types::PublicKey>> for CVec_PublicKeyZ {
1276         fn from(v: Vec<crate::c_types::PublicKey>) -> Self {
1277                 let datalen = v.len();
1278                 let data = Box::into_raw(v.into_boxed_slice());
1279                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1280         }
1281 }
1282 #[no_mangle]
1283 pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { }
1284 impl Drop for CVec_PublicKeyZ {
1285         fn drop(&mut self) {
1286                 if self.datalen == 0 { return; }
1287                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1288         }
1289 }
1290 #[repr(C)]
1291 pub struct CVec_u8Z {
1292         pub data: *mut u8,
1293         pub datalen: usize
1294 }
1295 impl CVec_u8Z {
1296         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u8> {
1297                 if self.datalen == 0 { return Vec::new(); }
1298                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
1299                 self.data = std::ptr::null_mut();
1300                 self.datalen = 0;
1301                 ret
1302         }
1303         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] {
1304                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
1305         }
1306 }
1307 impl From<Vec<u8>> for CVec_u8Z {
1308         fn from(v: Vec<u8>) -> Self {
1309                 let datalen = v.len();
1310                 let data = Box::into_raw(v.into_boxed_slice());
1311                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
1312         }
1313 }
1314 #[no_mangle]
1315 pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { }
1316 impl Drop for CVec_u8Z {
1317         fn drop(&mut self) {
1318                 if self.datalen == 0 { return; }
1319                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
1320         }
1321 }
1322 impl Clone for CVec_u8Z {
1323         fn clone(&self) -> Self {
1324                 let mut res = Vec::new();
1325                 if self.datalen == 0 { return Self::from(res); }
1326                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
1327                 Self::from(res)
1328         }
1329 }
1330 #[repr(C)]
1331 pub union CResult_CVec_u8ZPeerHandleErrorZPtr {
1332         pub result: *mut crate::c_types::derived::CVec_u8Z,
1333         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1334 }
1335 #[repr(C)]
1336 pub struct CResult_CVec_u8ZPeerHandleErrorZ {
1337         pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr,
1338         pub result_ok: bool,
1339 }
1340 #[no_mangle]
1341 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ {
1342         CResult_CVec_u8ZPeerHandleErrorZ {
1343                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1344                         result: Box::into_raw(Box::new(o)),
1345                 },
1346                 result_ok: true,
1347         }
1348 }
1349 #[no_mangle]
1350 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ {
1351         CResult_CVec_u8ZPeerHandleErrorZ {
1352                 contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1353                         err: Box::into_raw(Box::new(e)),
1354                 },
1355                 result_ok: false,
1356         }
1357 }
1358 #[no_mangle]
1359 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { }
1360 impl Drop for CResult_CVec_u8ZPeerHandleErrorZ {
1361         fn drop(&mut self) {
1362                 if self.result_ok {
1363                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1364                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1365                         }
1366                 } else {
1367                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1368                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1369                         }
1370                 }
1371         }
1372 }
1373 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>> for CResult_CVec_u8ZPeerHandleErrorZ {
1374         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_u8Z, crate::ln::peer_handler::PeerHandleError>) -> Self {
1375                 let contents = if o.result_ok {
1376                         let result = unsafe { o.contents.result };
1377                         unsafe { o.contents.result = std::ptr::null_mut() };
1378                         CResult_CVec_u8ZPeerHandleErrorZPtr { result }
1379                 } else {
1380                         let err = unsafe { o.contents.err };
1381                         unsafe { o.contents.err = std::ptr::null_mut(); }
1382                         CResult_CVec_u8ZPeerHandleErrorZPtr { err }
1383                 };
1384                 Self {
1385                         contents,
1386                         result_ok: o.result_ok,
1387                 }
1388         }
1389 }
1390 impl Clone for CResult_CVec_u8ZPeerHandleErrorZ {
1391         fn clone(&self) -> Self {
1392                 if self.result_ok {
1393                         Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1394                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_u8Z>::clone(unsafe { &*self.contents.result })))
1395                         } }
1396                 } else {
1397                         Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr {
1398                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1399                         } }
1400                 }
1401         }
1402 }
1403 #[no_mangle]
1404 pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { orig.clone() }
1405 #[repr(C)]
1406 pub union CResult_NonePeerHandleErrorZPtr {
1407         /// Note that this value is always NULL, as there are no contents in the OK variant
1408         pub result: *mut std::ffi::c_void,
1409         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1410 }
1411 #[repr(C)]
1412 pub struct CResult_NonePeerHandleErrorZ {
1413         pub contents: CResult_NonePeerHandleErrorZPtr,
1414         pub result_ok: bool,
1415 }
1416 #[no_mangle]
1417 pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ {
1418         CResult_NonePeerHandleErrorZ {
1419                 contents: CResult_NonePeerHandleErrorZPtr {
1420                         result: std::ptr::null_mut(),
1421                 },
1422                 result_ok: true,
1423         }
1424 }
1425 #[no_mangle]
1426 pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ {
1427         CResult_NonePeerHandleErrorZ {
1428                 contents: CResult_NonePeerHandleErrorZPtr {
1429                         err: Box::into_raw(Box::new(e)),
1430                 },
1431                 result_ok: false,
1432         }
1433 }
1434 #[no_mangle]
1435 pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { }
1436 impl Drop for CResult_NonePeerHandleErrorZ {
1437         fn drop(&mut self) {
1438                 if self.result_ok {
1439                 } else {
1440                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1441                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1442                         }
1443                 }
1444         }
1445 }
1446 impl From<crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>> for CResult_NonePeerHandleErrorZ {
1447         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::peer_handler::PeerHandleError>) -> Self {
1448                 let contents = if o.result_ok {
1449                         let _ = unsafe { Box::from_raw(o.contents.result) };
1450                         o.contents.result = std::ptr::null_mut();
1451                         CResult_NonePeerHandleErrorZPtr { result: std::ptr::null_mut() }
1452                 } else {
1453                         let err = unsafe { o.contents.err };
1454                         unsafe { o.contents.err = std::ptr::null_mut(); }
1455                         CResult_NonePeerHandleErrorZPtr { err }
1456                 };
1457                 Self {
1458                         contents,
1459                         result_ok: o.result_ok,
1460                 }
1461         }
1462 }
1463 impl Clone for CResult_NonePeerHandleErrorZ {
1464         fn clone(&self) -> Self {
1465                 if self.result_ok {
1466                         Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr {
1467                                 result: std::ptr::null_mut()
1468                         } }
1469                 } else {
1470                         Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr {
1471                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1472                         } }
1473                 }
1474         }
1475 }
1476 #[no_mangle]
1477 pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { orig.clone() }
1478 #[repr(C)]
1479 pub union CResult_boolPeerHandleErrorZPtr {
1480         pub result: *mut bool,
1481         pub err: *mut crate::ln::peer_handler::PeerHandleError,
1482 }
1483 #[repr(C)]
1484 pub struct CResult_boolPeerHandleErrorZ {
1485         pub contents: CResult_boolPeerHandleErrorZPtr,
1486         pub result_ok: bool,
1487 }
1488 #[no_mangle]
1489 pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ {
1490         CResult_boolPeerHandleErrorZ {
1491                 contents: CResult_boolPeerHandleErrorZPtr {
1492                         result: Box::into_raw(Box::new(o)),
1493                 },
1494                 result_ok: true,
1495         }
1496 }
1497 #[no_mangle]
1498 pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ {
1499         CResult_boolPeerHandleErrorZ {
1500                 contents: CResult_boolPeerHandleErrorZPtr {
1501                         err: Box::into_raw(Box::new(e)),
1502                 },
1503                 result_ok: false,
1504         }
1505 }
1506 #[no_mangle]
1507 pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { }
1508 impl Drop for CResult_boolPeerHandleErrorZ {
1509         fn drop(&mut self) {
1510                 if self.result_ok {
1511                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1512                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1513                         }
1514                 } else {
1515                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1516                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1517                         }
1518                 }
1519         }
1520 }
1521 impl From<crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>> for CResult_boolPeerHandleErrorZ {
1522         fn from(mut o: crate::c_types::CResultTempl<bool, crate::ln::peer_handler::PeerHandleError>) -> Self {
1523                 let contents = if o.result_ok {
1524                         let result = unsafe { o.contents.result };
1525                         unsafe { o.contents.result = std::ptr::null_mut() };
1526                         CResult_boolPeerHandleErrorZPtr { result }
1527                 } else {
1528                         let err = unsafe { o.contents.err };
1529                         unsafe { o.contents.err = std::ptr::null_mut(); }
1530                         CResult_boolPeerHandleErrorZPtr { err }
1531                 };
1532                 Self {
1533                         contents,
1534                         result_ok: o.result_ok,
1535                 }
1536         }
1537 }
1538 impl Clone for CResult_boolPeerHandleErrorZ {
1539         fn clone(&self) -> Self {
1540                 if self.result_ok {
1541                         Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr {
1542                                 result: Box::into_raw(Box::new(<bool>::clone(unsafe { &*self.contents.result })))
1543                         } }
1544                 } else {
1545                         Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr {
1546                                 err: Box::into_raw(Box::new(<crate::ln::peer_handler::PeerHandleError>::clone(unsafe { &*self.contents.err })))
1547                         } }
1548                 }
1549         }
1550 }
1551 #[no_mangle]
1552 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
1553 #[repr(C)]
1554 pub union CResult_InitFeaturesDecodeErrorZPtr {
1555         pub result: *mut crate::ln::features::InitFeatures,
1556         pub err: *mut crate::ln::msgs::DecodeError,
1557 }
1558 #[repr(C)]
1559 pub struct CResult_InitFeaturesDecodeErrorZ {
1560         pub contents: CResult_InitFeaturesDecodeErrorZPtr,
1561         pub result_ok: bool,
1562 }
1563 #[no_mangle]
1564 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
1565         CResult_InitFeaturesDecodeErrorZ {
1566                 contents: CResult_InitFeaturesDecodeErrorZPtr {
1567                         result: Box::into_raw(Box::new(o)),
1568                 },
1569                 result_ok: true,
1570         }
1571 }
1572 #[no_mangle]
1573 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
1574         CResult_InitFeaturesDecodeErrorZ {
1575                 contents: CResult_InitFeaturesDecodeErrorZPtr {
1576                         err: Box::into_raw(Box::new(e)),
1577                 },
1578                 result_ok: false,
1579         }
1580 }
1581 #[no_mangle]
1582 pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
1583 impl Drop for CResult_InitFeaturesDecodeErrorZ {
1584         fn drop(&mut self) {
1585                 if self.result_ok {
1586                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1587                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1588                         }
1589                 } else {
1590                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1591                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1592                         }
1593                 }
1594         }
1595 }
1596 impl From<crate::c_types::CResultTempl<crate::ln::features::InitFeatures, crate::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
1597         fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::InitFeatures, crate::ln::msgs::DecodeError>) -> Self {
1598                 let contents = if o.result_ok {
1599                         let result = unsafe { o.contents.result };
1600                         unsafe { o.contents.result = std::ptr::null_mut() };
1601                         CResult_InitFeaturesDecodeErrorZPtr { result }
1602                 } else {
1603                         let err = unsafe { o.contents.err };
1604                         unsafe { o.contents.err = std::ptr::null_mut(); }
1605                         CResult_InitFeaturesDecodeErrorZPtr { err }
1606                 };
1607                 Self {
1608                         contents,
1609                         result_ok: o.result_ok,
1610                 }
1611         }
1612 }
1613 #[repr(C)]
1614 pub union CResult_NodeFeaturesDecodeErrorZPtr {
1615         pub result: *mut crate::ln::features::NodeFeatures,
1616         pub err: *mut crate::ln::msgs::DecodeError,
1617 }
1618 #[repr(C)]
1619 pub struct CResult_NodeFeaturesDecodeErrorZ {
1620         pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
1621         pub result_ok: bool,
1622 }
1623 #[no_mangle]
1624 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
1625         CResult_NodeFeaturesDecodeErrorZ {
1626                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
1627                         result: Box::into_raw(Box::new(o)),
1628                 },
1629                 result_ok: true,
1630         }
1631 }
1632 #[no_mangle]
1633 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
1634         CResult_NodeFeaturesDecodeErrorZ {
1635                 contents: CResult_NodeFeaturesDecodeErrorZPtr {
1636                         err: Box::into_raw(Box::new(e)),
1637                 },
1638                 result_ok: false,
1639         }
1640 }
1641 #[no_mangle]
1642 pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
1643 impl Drop for CResult_NodeFeaturesDecodeErrorZ {
1644         fn drop(&mut self) {
1645                 if self.result_ok {
1646                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1647                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1648                         }
1649                 } else {
1650                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1651                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1652                         }
1653                 }
1654         }
1655 }
1656 impl From<crate::c_types::CResultTempl<crate::ln::features::NodeFeatures, crate::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
1657         fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::NodeFeatures, crate::ln::msgs::DecodeError>) -> Self {
1658                 let contents = if o.result_ok {
1659                         let result = unsafe { o.contents.result };
1660                         unsafe { o.contents.result = std::ptr::null_mut() };
1661                         CResult_NodeFeaturesDecodeErrorZPtr { result }
1662                 } else {
1663                         let err = unsafe { o.contents.err };
1664                         unsafe { o.contents.err = std::ptr::null_mut(); }
1665                         CResult_NodeFeaturesDecodeErrorZPtr { err }
1666                 };
1667                 Self {
1668                         contents,
1669                         result_ok: o.result_ok,
1670                 }
1671         }
1672 }
1673 #[repr(C)]
1674 pub union CResult_ChannelFeaturesDecodeErrorZPtr {
1675         pub result: *mut crate::ln::features::ChannelFeatures,
1676         pub err: *mut crate::ln::msgs::DecodeError,
1677 }
1678 #[repr(C)]
1679 pub struct CResult_ChannelFeaturesDecodeErrorZ {
1680         pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
1681         pub result_ok: bool,
1682 }
1683 #[no_mangle]
1684 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
1685         CResult_ChannelFeaturesDecodeErrorZ {
1686                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
1687                         result: Box::into_raw(Box::new(o)),
1688                 },
1689                 result_ok: true,
1690         }
1691 }
1692 #[no_mangle]
1693 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
1694         CResult_ChannelFeaturesDecodeErrorZ {
1695                 contents: CResult_ChannelFeaturesDecodeErrorZPtr {
1696                         err: Box::into_raw(Box::new(e)),
1697                 },
1698                 result_ok: false,
1699         }
1700 }
1701 #[no_mangle]
1702 pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
1703 impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
1704         fn drop(&mut self) {
1705                 if self.result_ok {
1706                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1707                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1708                         }
1709                 } else {
1710                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1711                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1712                         }
1713                 }
1714         }
1715 }
1716 impl From<crate::c_types::CResultTempl<crate::ln::features::ChannelFeatures, crate::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
1717         fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::ChannelFeatures, crate::ln::msgs::DecodeError>) -> Self {
1718                 let contents = if o.result_ok {
1719                         let result = unsafe { o.contents.result };
1720                         unsafe { o.contents.result = std::ptr::null_mut() };
1721                         CResult_ChannelFeaturesDecodeErrorZPtr { result }
1722                 } else {
1723                         let err = unsafe { o.contents.err };
1724                         unsafe { o.contents.err = std::ptr::null_mut(); }
1725                         CResult_ChannelFeaturesDecodeErrorZPtr { err }
1726                 };
1727                 Self {
1728                         contents,
1729                         result_ok: o.result_ok,
1730                 }
1731         }
1732 }
1733 #[repr(C)]
1734 pub union CResult_InvoiceFeaturesDecodeErrorZPtr {
1735         pub result: *mut crate::ln::features::InvoiceFeatures,
1736         pub err: *mut crate::ln::msgs::DecodeError,
1737 }
1738 #[repr(C)]
1739 pub struct CResult_InvoiceFeaturesDecodeErrorZ {
1740         pub contents: CResult_InvoiceFeaturesDecodeErrorZPtr,
1741         pub result_ok: bool,
1742 }
1743 #[no_mangle]
1744 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_ok(o: crate::ln::features::InvoiceFeatures) -> CResult_InvoiceFeaturesDecodeErrorZ {
1745         CResult_InvoiceFeaturesDecodeErrorZ {
1746                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
1747                         result: Box::into_raw(Box::new(o)),
1748                 },
1749                 result_ok: true,
1750         }
1751 }
1752 #[no_mangle]
1753 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InvoiceFeaturesDecodeErrorZ {
1754         CResult_InvoiceFeaturesDecodeErrorZ {
1755                 contents: CResult_InvoiceFeaturesDecodeErrorZPtr {
1756                         err: Box::into_raw(Box::new(e)),
1757                 },
1758                 result_ok: false,
1759         }
1760 }
1761 #[no_mangle]
1762 pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { }
1763 impl Drop for CResult_InvoiceFeaturesDecodeErrorZ {
1764         fn drop(&mut self) {
1765                 if self.result_ok {
1766                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1767                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1768                         }
1769                 } else {
1770                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1771                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1772                         }
1773                 }
1774         }
1775 }
1776 impl From<crate::c_types::CResultTempl<crate::ln::features::InvoiceFeatures, crate::ln::msgs::DecodeError>> for CResult_InvoiceFeaturesDecodeErrorZ {
1777         fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::InvoiceFeatures, crate::ln::msgs::DecodeError>) -> Self {
1778                 let contents = if o.result_ok {
1779                         let result = unsafe { o.contents.result };
1780                         unsafe { o.contents.result = std::ptr::null_mut() };
1781                         CResult_InvoiceFeaturesDecodeErrorZPtr { result }
1782                 } else {
1783                         let err = unsafe { o.contents.err };
1784                         unsafe { o.contents.err = std::ptr::null_mut(); }
1785                         CResult_InvoiceFeaturesDecodeErrorZPtr { err }
1786                 };
1787                 Self {
1788                         contents,
1789                         result_ok: o.result_ok,
1790                 }
1791         }
1792 }
1793 #[repr(C)]
1794 pub union CResult_ChannelConfigDecodeErrorZPtr {
1795         pub result: *mut crate::util::config::ChannelConfig,
1796         pub err: *mut crate::ln::msgs::DecodeError,
1797 }
1798 #[repr(C)]
1799 pub struct CResult_ChannelConfigDecodeErrorZ {
1800         pub contents: CResult_ChannelConfigDecodeErrorZPtr,
1801         pub result_ok: bool,
1802 }
1803 #[no_mangle]
1804 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ {
1805         CResult_ChannelConfigDecodeErrorZ {
1806                 contents: CResult_ChannelConfigDecodeErrorZPtr {
1807                         result: Box::into_raw(Box::new(o)),
1808                 },
1809                 result_ok: true,
1810         }
1811 }
1812 #[no_mangle]
1813 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ {
1814         CResult_ChannelConfigDecodeErrorZ {
1815                 contents: CResult_ChannelConfigDecodeErrorZPtr {
1816                         err: Box::into_raw(Box::new(e)),
1817                 },
1818                 result_ok: false,
1819         }
1820 }
1821 #[no_mangle]
1822 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { }
1823 impl Drop for CResult_ChannelConfigDecodeErrorZ {
1824         fn drop(&mut self) {
1825                 if self.result_ok {
1826                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1827                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1828                         }
1829                 } else {
1830                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1831                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1832                         }
1833                 }
1834         }
1835 }
1836 impl From<crate::c_types::CResultTempl<crate::util::config::ChannelConfig, crate::ln::msgs::DecodeError>> for CResult_ChannelConfigDecodeErrorZ {
1837         fn from(mut o: crate::c_types::CResultTempl<crate::util::config::ChannelConfig, crate::ln::msgs::DecodeError>) -> Self {
1838                 let contents = if o.result_ok {
1839                         let result = unsafe { o.contents.result };
1840                         unsafe { o.contents.result = std::ptr::null_mut() };
1841                         CResult_ChannelConfigDecodeErrorZPtr { result }
1842                 } else {
1843                         let err = unsafe { o.contents.err };
1844                         unsafe { o.contents.err = std::ptr::null_mut(); }
1845                         CResult_ChannelConfigDecodeErrorZPtr { err }
1846                 };
1847                 Self {
1848                         contents,
1849                         result_ok: o.result_ok,
1850                 }
1851         }
1852 }
1853 impl Clone for CResult_ChannelConfigDecodeErrorZ {
1854         fn clone(&self) -> Self {
1855                 if self.result_ok {
1856                         Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr {
1857                                 result: Box::into_raw(Box::new(<crate::util::config::ChannelConfig>::clone(unsafe { &*self.contents.result })))
1858                         } }
1859                 } else {
1860                         Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr {
1861                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1862                         } }
1863                 }
1864         }
1865 }
1866 #[no_mangle]
1867 pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { orig.clone() }
1868 #[repr(C)]
1869 pub union CResult_DirectionalChannelInfoDecodeErrorZPtr {
1870         pub result: *mut crate::routing::network_graph::DirectionalChannelInfo,
1871         pub err: *mut crate::ln::msgs::DecodeError,
1872 }
1873 #[repr(C)]
1874 pub struct CResult_DirectionalChannelInfoDecodeErrorZ {
1875         pub contents: CResult_DirectionalChannelInfoDecodeErrorZPtr,
1876         pub result_ok: bool,
1877 }
1878 #[no_mangle]
1879 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: crate::routing::network_graph::DirectionalChannelInfo) -> CResult_DirectionalChannelInfoDecodeErrorZ {
1880         CResult_DirectionalChannelInfoDecodeErrorZ {
1881                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1882                         result: Box::into_raw(Box::new(o)),
1883                 },
1884                 result_ok: true,
1885         }
1886 }
1887 #[no_mangle]
1888 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_DirectionalChannelInfoDecodeErrorZ {
1889         CResult_DirectionalChannelInfoDecodeErrorZ {
1890                 contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1891                         err: Box::into_raw(Box::new(e)),
1892                 },
1893                 result_ok: false,
1894         }
1895 }
1896 #[no_mangle]
1897 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { }
1898 impl Drop for CResult_DirectionalChannelInfoDecodeErrorZ {
1899         fn drop(&mut self) {
1900                 if self.result_ok {
1901                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1902                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1903                         }
1904                 } else {
1905                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1906                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1907                         }
1908                 }
1909         }
1910 }
1911 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::DirectionalChannelInfo, crate::ln::msgs::DecodeError>> for CResult_DirectionalChannelInfoDecodeErrorZ {
1912         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::DirectionalChannelInfo, crate::ln::msgs::DecodeError>) -> Self {
1913                 let contents = if o.result_ok {
1914                         let result = unsafe { o.contents.result };
1915                         unsafe { o.contents.result = std::ptr::null_mut() };
1916                         CResult_DirectionalChannelInfoDecodeErrorZPtr { result }
1917                 } else {
1918                         let err = unsafe { o.contents.err };
1919                         unsafe { o.contents.err = std::ptr::null_mut(); }
1920                         CResult_DirectionalChannelInfoDecodeErrorZPtr { err }
1921                 };
1922                 Self {
1923                         contents,
1924                         result_ok: o.result_ok,
1925                 }
1926         }
1927 }
1928 impl Clone for CResult_DirectionalChannelInfoDecodeErrorZ {
1929         fn clone(&self) -> Self {
1930                 if self.result_ok {
1931                         Self { result_ok: true, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1932                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::DirectionalChannelInfo>::clone(unsafe { &*self.contents.result })))
1933                         } }
1934                 } else {
1935                         Self { result_ok: false, contents: CResult_DirectionalChannelInfoDecodeErrorZPtr {
1936                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
1937                         } }
1938                 }
1939         }
1940 }
1941 #[no_mangle]
1942 pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig: &CResult_DirectionalChannelInfoDecodeErrorZ) -> CResult_DirectionalChannelInfoDecodeErrorZ { orig.clone() }
1943 #[repr(C)]
1944 pub union CResult_ChannelInfoDecodeErrorZPtr {
1945         pub result: *mut crate::routing::network_graph::ChannelInfo,
1946         pub err: *mut crate::ln::msgs::DecodeError,
1947 }
1948 #[repr(C)]
1949 pub struct CResult_ChannelInfoDecodeErrorZ {
1950         pub contents: CResult_ChannelInfoDecodeErrorZPtr,
1951         pub result_ok: bool,
1952 }
1953 #[no_mangle]
1954 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::routing::network_graph::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ {
1955         CResult_ChannelInfoDecodeErrorZ {
1956                 contents: CResult_ChannelInfoDecodeErrorZPtr {
1957                         result: Box::into_raw(Box::new(o)),
1958                 },
1959                 result_ok: true,
1960         }
1961 }
1962 #[no_mangle]
1963 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ {
1964         CResult_ChannelInfoDecodeErrorZ {
1965                 contents: CResult_ChannelInfoDecodeErrorZPtr {
1966                         err: Box::into_raw(Box::new(e)),
1967                 },
1968                 result_ok: false,
1969         }
1970 }
1971 #[no_mangle]
1972 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { }
1973 impl Drop for CResult_ChannelInfoDecodeErrorZ {
1974         fn drop(&mut self) {
1975                 if self.result_ok {
1976                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
1977                                 let _ = unsafe { Box::from_raw(self.contents.result) };
1978                         }
1979                 } else {
1980                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
1981                                 let _ = unsafe { Box::from_raw(self.contents.err) };
1982                         }
1983                 }
1984         }
1985 }
1986 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInfo, crate::ln::msgs::DecodeError>> for CResult_ChannelInfoDecodeErrorZ {
1987         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::ChannelInfo, crate::ln::msgs::DecodeError>) -> Self {
1988                 let contents = if o.result_ok {
1989                         let result = unsafe { o.contents.result };
1990                         unsafe { o.contents.result = std::ptr::null_mut() };
1991                         CResult_ChannelInfoDecodeErrorZPtr { result }
1992                 } else {
1993                         let err = unsafe { o.contents.err };
1994                         unsafe { o.contents.err = std::ptr::null_mut(); }
1995                         CResult_ChannelInfoDecodeErrorZPtr { err }
1996                 };
1997                 Self {
1998                         contents,
1999                         result_ok: o.result_ok,
2000                 }
2001         }
2002 }
2003 impl Clone for CResult_ChannelInfoDecodeErrorZ {
2004         fn clone(&self) -> Self {
2005                 if self.result_ok {
2006                         Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr {
2007                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::ChannelInfo>::clone(unsafe { &*self.contents.result })))
2008                         } }
2009                 } else {
2010                         Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr {
2011                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2012                         } }
2013                 }
2014         }
2015 }
2016 #[no_mangle]
2017 pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { orig.clone() }
2018 #[repr(C)]
2019 pub union CResult_RoutingFeesDecodeErrorZPtr {
2020         pub result: *mut crate::routing::network_graph::RoutingFees,
2021         pub err: *mut crate::ln::msgs::DecodeError,
2022 }
2023 #[repr(C)]
2024 pub struct CResult_RoutingFeesDecodeErrorZ {
2025         pub contents: CResult_RoutingFeesDecodeErrorZPtr,
2026         pub result_ok: bool,
2027 }
2028 #[no_mangle]
2029 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::routing::network_graph::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ {
2030         CResult_RoutingFeesDecodeErrorZ {
2031                 contents: CResult_RoutingFeesDecodeErrorZPtr {
2032                         result: Box::into_raw(Box::new(o)),
2033                 },
2034                 result_ok: true,
2035         }
2036 }
2037 #[no_mangle]
2038 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ {
2039         CResult_RoutingFeesDecodeErrorZ {
2040                 contents: CResult_RoutingFeesDecodeErrorZPtr {
2041                         err: Box::into_raw(Box::new(e)),
2042                 },
2043                 result_ok: false,
2044         }
2045 }
2046 #[no_mangle]
2047 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { }
2048 impl Drop for CResult_RoutingFeesDecodeErrorZ {
2049         fn drop(&mut self) {
2050                 if self.result_ok {
2051                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2052                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2053                         }
2054                 } else {
2055                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2056                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2057                         }
2058                 }
2059         }
2060 }
2061 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>> for CResult_RoutingFeesDecodeErrorZ {
2062         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::RoutingFees, crate::ln::msgs::DecodeError>) -> Self {
2063                 let contents = if o.result_ok {
2064                         let result = unsafe { o.contents.result };
2065                         unsafe { o.contents.result = std::ptr::null_mut() };
2066                         CResult_RoutingFeesDecodeErrorZPtr { result }
2067                 } else {
2068                         let err = unsafe { o.contents.err };
2069                         unsafe { o.contents.err = std::ptr::null_mut(); }
2070                         CResult_RoutingFeesDecodeErrorZPtr { err }
2071                 };
2072                 Self {
2073                         contents,
2074                         result_ok: o.result_ok,
2075                 }
2076         }
2077 }
2078 impl Clone for CResult_RoutingFeesDecodeErrorZ {
2079         fn clone(&self) -> Self {
2080                 if self.result_ok {
2081                         Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr {
2082                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::RoutingFees>::clone(unsafe { &*self.contents.result })))
2083                         } }
2084                 } else {
2085                         Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr {
2086                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2087                         } }
2088                 }
2089         }
2090 }
2091 #[no_mangle]
2092 pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { orig.clone() }
2093 #[repr(C)]
2094 pub struct CVec_NetAddressZ {
2095         pub data: *mut crate::ln::msgs::NetAddress,
2096         pub datalen: usize
2097 }
2098 impl CVec_NetAddressZ {
2099         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::NetAddress> {
2100                 if self.datalen == 0 { return Vec::new(); }
2101                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2102                 self.data = std::ptr::null_mut();
2103                 self.datalen = 0;
2104                 ret
2105         }
2106         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::NetAddress] {
2107                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2108         }
2109 }
2110 impl From<Vec<crate::ln::msgs::NetAddress>> for CVec_NetAddressZ {
2111         fn from(v: Vec<crate::ln::msgs::NetAddress>) -> Self {
2112                 let datalen = v.len();
2113                 let data = Box::into_raw(v.into_boxed_slice());
2114                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2115         }
2116 }
2117 #[no_mangle]
2118 pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { }
2119 impl Drop for CVec_NetAddressZ {
2120         fn drop(&mut self) {
2121                 if self.datalen == 0 { return; }
2122                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2123         }
2124 }
2125 impl Clone for CVec_NetAddressZ {
2126         fn clone(&self) -> Self {
2127                 let mut res = Vec::new();
2128                 if self.datalen == 0 { return Self::from(res); }
2129                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2130                 Self::from(res)
2131         }
2132 }
2133 #[repr(C)]
2134 pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2135         pub result: *mut crate::routing::network_graph::NodeAnnouncementInfo,
2136         pub err: *mut crate::ln::msgs::DecodeError,
2137 }
2138 #[repr(C)]
2139 pub struct CResult_NodeAnnouncementInfoDecodeErrorZ {
2140         pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr,
2141         pub result_ok: bool,
2142 }
2143 #[no_mangle]
2144 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
2145         CResult_NodeAnnouncementInfoDecodeErrorZ {
2146                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2147                         result: Box::into_raw(Box::new(o)),
2148                 },
2149                 result_ok: true,
2150         }
2151 }
2152 #[no_mangle]
2153 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ {
2154         CResult_NodeAnnouncementInfoDecodeErrorZ {
2155                 contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2156                         err: Box::into_raw(Box::new(e)),
2157                 },
2158                 result_ok: false,
2159         }
2160 }
2161 #[no_mangle]
2162 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { }
2163 impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ {
2164         fn drop(&mut self) {
2165                 if self.result_ok {
2166                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2167                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2168                         }
2169                 } else {
2170                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2171                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2172                         }
2173                 }
2174         }
2175 }
2176 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementInfoDecodeErrorZ {
2177         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeAnnouncementInfo, crate::ln::msgs::DecodeError>) -> Self {
2178                 let contents = if o.result_ok {
2179                         let result = unsafe { o.contents.result };
2180                         unsafe { o.contents.result = std::ptr::null_mut() };
2181                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { result }
2182                 } else {
2183                         let err = unsafe { o.contents.err };
2184                         unsafe { o.contents.err = std::ptr::null_mut(); }
2185                         CResult_NodeAnnouncementInfoDecodeErrorZPtr { err }
2186                 };
2187                 Self {
2188                         contents,
2189                         result_ok: o.result_ok,
2190                 }
2191         }
2192 }
2193 impl Clone for CResult_NodeAnnouncementInfoDecodeErrorZ {
2194         fn clone(&self) -> Self {
2195                 if self.result_ok {
2196                         Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2197                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeAnnouncementInfo>::clone(unsafe { &*self.contents.result })))
2198                         } }
2199                 } else {
2200                         Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr {
2201                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2202                         } }
2203                 }
2204         }
2205 }
2206 #[no_mangle]
2207 pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { orig.clone() }
2208 #[repr(C)]
2209 pub struct CVec_u64Z {
2210         pub data: *mut u64,
2211         pub datalen: usize
2212 }
2213 impl CVec_u64Z {
2214         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<u64> {
2215                 if self.datalen == 0 { return Vec::new(); }
2216                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2217                 self.data = std::ptr::null_mut();
2218                 self.datalen = 0;
2219                 ret
2220         }
2221         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] {
2222                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2223         }
2224 }
2225 impl From<Vec<u64>> for CVec_u64Z {
2226         fn from(v: Vec<u64>) -> Self {
2227                 let datalen = v.len();
2228                 let data = Box::into_raw(v.into_boxed_slice());
2229                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2230         }
2231 }
2232 #[no_mangle]
2233 pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { }
2234 impl Drop for CVec_u64Z {
2235         fn drop(&mut self) {
2236                 if self.datalen == 0 { return; }
2237                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2238         }
2239 }
2240 impl Clone for CVec_u64Z {
2241         fn clone(&self) -> Self {
2242                 let mut res = Vec::new();
2243                 if self.datalen == 0 { return Self::from(res); }
2244                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2245                 Self::from(res)
2246         }
2247 }
2248 #[repr(C)]
2249 pub union CResult_NodeInfoDecodeErrorZPtr {
2250         pub result: *mut crate::routing::network_graph::NodeInfo,
2251         pub err: *mut crate::ln::msgs::DecodeError,
2252 }
2253 #[repr(C)]
2254 pub struct CResult_NodeInfoDecodeErrorZ {
2255         pub contents: CResult_NodeInfoDecodeErrorZPtr,
2256         pub result_ok: bool,
2257 }
2258 #[no_mangle]
2259 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::routing::network_graph::NodeInfo) -> CResult_NodeInfoDecodeErrorZ {
2260         CResult_NodeInfoDecodeErrorZ {
2261                 contents: CResult_NodeInfoDecodeErrorZPtr {
2262                         result: Box::into_raw(Box::new(o)),
2263                 },
2264                 result_ok: true,
2265         }
2266 }
2267 #[no_mangle]
2268 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ {
2269         CResult_NodeInfoDecodeErrorZ {
2270                 contents: CResult_NodeInfoDecodeErrorZPtr {
2271                         err: Box::into_raw(Box::new(e)),
2272                 },
2273                 result_ok: false,
2274         }
2275 }
2276 #[no_mangle]
2277 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { }
2278 impl Drop for CResult_NodeInfoDecodeErrorZ {
2279         fn drop(&mut self) {
2280                 if self.result_ok {
2281                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2282                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2283                         }
2284                 } else {
2285                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2286                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2287                         }
2288                 }
2289         }
2290 }
2291 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>> for CResult_NodeInfoDecodeErrorZ {
2292         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NodeInfo, crate::ln::msgs::DecodeError>) -> Self {
2293                 let contents = if o.result_ok {
2294                         let result = unsafe { o.contents.result };
2295                         unsafe { o.contents.result = std::ptr::null_mut() };
2296                         CResult_NodeInfoDecodeErrorZPtr { result }
2297                 } else {
2298                         let err = unsafe { o.contents.err };
2299                         unsafe { o.contents.err = std::ptr::null_mut(); }
2300                         CResult_NodeInfoDecodeErrorZPtr { err }
2301                 };
2302                 Self {
2303                         contents,
2304                         result_ok: o.result_ok,
2305                 }
2306         }
2307 }
2308 impl Clone for CResult_NodeInfoDecodeErrorZ {
2309         fn clone(&self) -> Self {
2310                 if self.result_ok {
2311                         Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr {
2312                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NodeInfo>::clone(unsafe { &*self.contents.result })))
2313                         } }
2314                 } else {
2315                         Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr {
2316                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2317                         } }
2318                 }
2319         }
2320 }
2321 #[no_mangle]
2322 pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { orig.clone() }
2323 #[repr(C)]
2324 pub union CResult_NetworkGraphDecodeErrorZPtr {
2325         pub result: *mut crate::routing::network_graph::NetworkGraph,
2326         pub err: *mut crate::ln::msgs::DecodeError,
2327 }
2328 #[repr(C)]
2329 pub struct CResult_NetworkGraphDecodeErrorZ {
2330         pub contents: CResult_NetworkGraphDecodeErrorZPtr,
2331         pub result_ok: bool,
2332 }
2333 #[no_mangle]
2334 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::routing::network_graph::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ {
2335         CResult_NetworkGraphDecodeErrorZ {
2336                 contents: CResult_NetworkGraphDecodeErrorZPtr {
2337                         result: Box::into_raw(Box::new(o)),
2338                 },
2339                 result_ok: true,
2340         }
2341 }
2342 #[no_mangle]
2343 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ {
2344         CResult_NetworkGraphDecodeErrorZ {
2345                 contents: CResult_NetworkGraphDecodeErrorZPtr {
2346                         err: Box::into_raw(Box::new(e)),
2347                 },
2348                 result_ok: false,
2349         }
2350 }
2351 #[no_mangle]
2352 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { }
2353 impl Drop for CResult_NetworkGraphDecodeErrorZ {
2354         fn drop(&mut self) {
2355                 if self.result_ok {
2356                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2357                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2358                         }
2359                 } else {
2360                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2361                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2362                         }
2363                 }
2364         }
2365 }
2366 impl From<crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>> for CResult_NetworkGraphDecodeErrorZ {
2367         fn from(mut o: crate::c_types::CResultTempl<crate::routing::network_graph::NetworkGraph, crate::ln::msgs::DecodeError>) -> Self {
2368                 let contents = if o.result_ok {
2369                         let result = unsafe { o.contents.result };
2370                         unsafe { o.contents.result = std::ptr::null_mut() };
2371                         CResult_NetworkGraphDecodeErrorZPtr { result }
2372                 } else {
2373                         let err = unsafe { o.contents.err };
2374                         unsafe { o.contents.err = std::ptr::null_mut(); }
2375                         CResult_NetworkGraphDecodeErrorZPtr { err }
2376                 };
2377                 Self {
2378                         contents,
2379                         result_ok: o.result_ok,
2380                 }
2381         }
2382 }
2383 impl Clone for CResult_NetworkGraphDecodeErrorZ {
2384         fn clone(&self) -> Self {
2385                 if self.result_ok {
2386                         Self { result_ok: true, contents: CResult_NetworkGraphDecodeErrorZPtr {
2387                                 result: Box::into_raw(Box::new(<crate::routing::network_graph::NetworkGraph>::clone(unsafe { &*self.contents.result })))
2388                         } }
2389                 } else {
2390                         Self { result_ok: false, contents: CResult_NetworkGraphDecodeErrorZPtr {
2391                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2392                         } }
2393                 }
2394         }
2395 }
2396 #[no_mangle]
2397 pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_clone(orig: &CResult_NetworkGraphDecodeErrorZ) -> CResult_NetworkGraphDecodeErrorZ { orig.clone() }
2398 #[repr(C)]
2399 pub struct C2Tuple_usizeTransactionZ {
2400         pub a: usize,
2401         pub b: crate::c_types::Transaction,
2402 }
2403 impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ {
2404         fn from (tup: (usize, crate::c_types::Transaction)) -> Self {
2405                 Self {
2406                         a: tup.0,
2407                         b: tup.1,
2408                 }
2409         }
2410 }
2411 impl C2Tuple_usizeTransactionZ {
2412         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) {
2413                 (self.a, self.b)
2414         }
2415 }
2416 #[no_mangle]
2417 pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ {
2418         C2Tuple_usizeTransactionZ { a, b, }
2419 }
2420
2421 #[no_mangle]
2422 pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { }
2423 #[repr(C)]
2424 pub struct CVec_C2Tuple_usizeTransactionZZ {
2425         pub data: *mut crate::c_types::derived::C2Tuple_usizeTransactionZ,
2426         pub datalen: usize
2427 }
2428 impl CVec_C2Tuple_usizeTransactionZZ {
2429         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ> {
2430                 if self.datalen == 0 { return Vec::new(); }
2431                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2432                 self.data = std::ptr::null_mut();
2433                 self.datalen = 0;
2434                 ret
2435         }
2436         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_usizeTransactionZ] {
2437                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2438         }
2439 }
2440 impl From<Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>> for CVec_C2Tuple_usizeTransactionZZ {
2441         fn from(v: Vec<crate::c_types::derived::C2Tuple_usizeTransactionZ>) -> Self {
2442                 let datalen = v.len();
2443                 let data = Box::into_raw(v.into_boxed_slice());
2444                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2445         }
2446 }
2447 #[no_mangle]
2448 pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { }
2449 impl Drop for CVec_C2Tuple_usizeTransactionZZ {
2450         fn drop(&mut self) {
2451                 if self.datalen == 0 { return; }
2452                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2453         }
2454 }
2455 #[repr(C)]
2456 pub union CResult_NoneChannelMonitorUpdateErrZPtr {
2457         /// Note that this value is always NULL, as there are no contents in the OK variant
2458         pub result: *mut std::ffi::c_void,
2459         pub err: *mut crate::chain::channelmonitor::ChannelMonitorUpdateErr,
2460 }
2461 #[repr(C)]
2462 pub struct CResult_NoneChannelMonitorUpdateErrZ {
2463         pub contents: CResult_NoneChannelMonitorUpdateErrZPtr,
2464         pub result_ok: bool,
2465 }
2466 #[no_mangle]
2467 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_ok() -> CResult_NoneChannelMonitorUpdateErrZ {
2468         CResult_NoneChannelMonitorUpdateErrZ {
2469                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2470                         result: std::ptr::null_mut(),
2471                 },
2472                 result_ok: true,
2473         }
2474 }
2475 #[no_mangle]
2476 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::chain::channelmonitor::ChannelMonitorUpdateErr) -> CResult_NoneChannelMonitorUpdateErrZ {
2477         CResult_NoneChannelMonitorUpdateErrZ {
2478                 contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2479                         err: Box::into_raw(Box::new(e)),
2480                 },
2481                 result_ok: false,
2482         }
2483 }
2484 #[no_mangle]
2485 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { }
2486 impl Drop for CResult_NoneChannelMonitorUpdateErrZ {
2487         fn drop(&mut self) {
2488                 if self.result_ok {
2489                 } else {
2490                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2491                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2492                         }
2493                 }
2494         }
2495 }
2496 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>> for CResult_NoneChannelMonitorUpdateErrZ {
2497         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::ChannelMonitorUpdateErr>) -> Self {
2498                 let contents = if o.result_ok {
2499                         let _ = unsafe { Box::from_raw(o.contents.result) };
2500                         o.contents.result = std::ptr::null_mut();
2501                         CResult_NoneChannelMonitorUpdateErrZPtr { result: std::ptr::null_mut() }
2502                 } else {
2503                         let err = unsafe { o.contents.err };
2504                         unsafe { o.contents.err = std::ptr::null_mut(); }
2505                         CResult_NoneChannelMonitorUpdateErrZPtr { err }
2506                 };
2507                 Self {
2508                         contents,
2509                         result_ok: o.result_ok,
2510                 }
2511         }
2512 }
2513 impl Clone for CResult_NoneChannelMonitorUpdateErrZ {
2514         fn clone(&self) -> Self {
2515                 if self.result_ok {
2516                         Self { result_ok: true, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2517                                 result: std::ptr::null_mut()
2518                         } }
2519                 } else {
2520                         Self { result_ok: false, contents: CResult_NoneChannelMonitorUpdateErrZPtr {
2521                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdateErr>::clone(unsafe { &*self.contents.err })))
2522                         } }
2523                 }
2524         }
2525 }
2526 #[no_mangle]
2527 pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_clone(orig: &CResult_NoneChannelMonitorUpdateErrZ) -> CResult_NoneChannelMonitorUpdateErrZ { orig.clone() }
2528 #[repr(C)]
2529 pub struct CVec_MonitorEventZ {
2530         pub data: *mut crate::chain::channelmonitor::MonitorEvent,
2531         pub datalen: usize
2532 }
2533 impl CVec_MonitorEventZ {
2534         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::MonitorEvent> {
2535                 if self.datalen == 0 { return Vec::new(); }
2536                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2537                 self.data = std::ptr::null_mut();
2538                 self.datalen = 0;
2539                 ret
2540         }
2541         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::MonitorEvent] {
2542                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2543         }
2544 }
2545 impl From<Vec<crate::chain::channelmonitor::MonitorEvent>> for CVec_MonitorEventZ {
2546         fn from(v: Vec<crate::chain::channelmonitor::MonitorEvent>) -> Self {
2547                 let datalen = v.len();
2548                 let data = Box::into_raw(v.into_boxed_slice());
2549                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2550         }
2551 }
2552 #[no_mangle]
2553 pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { }
2554 impl Drop for CVec_MonitorEventZ {
2555         fn drop(&mut self) {
2556                 if self.datalen == 0 { return; }
2557                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2558         }
2559 }
2560 impl Clone for CVec_MonitorEventZ {
2561         fn clone(&self) -> Self {
2562                 let mut res = Vec::new();
2563                 if self.datalen == 0 { return Self::from(res); }
2564                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2565                 Self::from(res)
2566         }
2567 }
2568 #[repr(C)]
2569 pub struct CVec_EventZ {
2570         pub data: *mut crate::util::events::Event,
2571         pub datalen: usize
2572 }
2573 impl CVec_EventZ {
2574         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::events::Event> {
2575                 if self.datalen == 0 { return Vec::new(); }
2576                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2577                 self.data = std::ptr::null_mut();
2578                 self.datalen = 0;
2579                 ret
2580         }
2581         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::events::Event] {
2582                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2583         }
2584 }
2585 impl From<Vec<crate::util::events::Event>> for CVec_EventZ {
2586         fn from(v: Vec<crate::util::events::Event>) -> Self {
2587                 let datalen = v.len();
2588                 let data = Box::into_raw(v.into_boxed_slice());
2589                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2590         }
2591 }
2592 #[no_mangle]
2593 pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { }
2594 impl Drop for CVec_EventZ {
2595         fn drop(&mut self) {
2596                 if self.datalen == 0 { return; }
2597                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
2598         }
2599 }
2600 impl Clone for CVec_EventZ {
2601         fn clone(&self) -> Self {
2602                 let mut res = Vec::new();
2603                 if self.datalen == 0 { return Self::from(res); }
2604                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
2605                 Self::from(res)
2606         }
2607 }
2608 #[repr(C)]
2609 pub union CResult_OutPointDecodeErrorZPtr {
2610         pub result: *mut crate::chain::transaction::OutPoint,
2611         pub err: *mut crate::ln::msgs::DecodeError,
2612 }
2613 #[repr(C)]
2614 pub struct CResult_OutPointDecodeErrorZ {
2615         pub contents: CResult_OutPointDecodeErrorZPtr,
2616         pub result_ok: bool,
2617 }
2618 #[no_mangle]
2619 pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ {
2620         CResult_OutPointDecodeErrorZ {
2621                 contents: CResult_OutPointDecodeErrorZPtr {
2622                         result: Box::into_raw(Box::new(o)),
2623                 },
2624                 result_ok: true,
2625         }
2626 }
2627 #[no_mangle]
2628 pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ {
2629         CResult_OutPointDecodeErrorZ {
2630                 contents: CResult_OutPointDecodeErrorZPtr {
2631                         err: Box::into_raw(Box::new(e)),
2632                 },
2633                 result_ok: false,
2634         }
2635 }
2636 #[no_mangle]
2637 pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { }
2638 impl Drop for CResult_OutPointDecodeErrorZ {
2639         fn drop(&mut self) {
2640                 if self.result_ok {
2641                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2642                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2643                         }
2644                 } else {
2645                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2646                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2647                         }
2648                 }
2649         }
2650 }
2651 impl From<crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>> for CResult_OutPointDecodeErrorZ {
2652         fn from(mut o: crate::c_types::CResultTempl<crate::chain::transaction::OutPoint, crate::ln::msgs::DecodeError>) -> Self {
2653                 let contents = if o.result_ok {
2654                         let result = unsafe { o.contents.result };
2655                         unsafe { o.contents.result = std::ptr::null_mut() };
2656                         CResult_OutPointDecodeErrorZPtr { result }
2657                 } else {
2658                         let err = unsafe { o.contents.err };
2659                         unsafe { o.contents.err = std::ptr::null_mut(); }
2660                         CResult_OutPointDecodeErrorZPtr { err }
2661                 };
2662                 Self {
2663                         contents,
2664                         result_ok: o.result_ok,
2665                 }
2666         }
2667 }
2668 impl Clone for CResult_OutPointDecodeErrorZ {
2669         fn clone(&self) -> Self {
2670                 if self.result_ok {
2671                         Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr {
2672                                 result: Box::into_raw(Box::new(<crate::chain::transaction::OutPoint>::clone(unsafe { &*self.contents.result })))
2673                         } }
2674                 } else {
2675                         Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr {
2676                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2677                         } }
2678                 }
2679         }
2680 }
2681 #[no_mangle]
2682 pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { orig.clone() }
2683 #[repr(C)]
2684 pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2685         pub result: *mut crate::chain::channelmonitor::ChannelMonitorUpdate,
2686         pub err: *mut crate::ln::msgs::DecodeError,
2687 }
2688 #[repr(C)]
2689 pub struct CResult_ChannelMonitorUpdateDecodeErrorZ {
2690         pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr,
2691         pub result_ok: bool,
2692 }
2693 #[no_mangle]
2694 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2695         CResult_ChannelMonitorUpdateDecodeErrorZ {
2696                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2697                         result: Box::into_raw(Box::new(o)),
2698                 },
2699                 result_ok: true,
2700         }
2701 }
2702 #[no_mangle]
2703 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ {
2704         CResult_ChannelMonitorUpdateDecodeErrorZ {
2705                 contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2706                         err: Box::into_raw(Box::new(e)),
2707                 },
2708                 result_ok: false,
2709         }
2710 }
2711 #[no_mangle]
2712 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { }
2713 impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ {
2714         fn drop(&mut self) {
2715                 if self.result_ok {
2716                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2717                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2718                         }
2719                 } else {
2720                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2721                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2722                         }
2723                 }
2724         }
2725 }
2726 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelMonitorUpdateDecodeErrorZ {
2727         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::ChannelMonitorUpdate, crate::ln::msgs::DecodeError>) -> Self {
2728                 let contents = if o.result_ok {
2729                         let result = unsafe { o.contents.result };
2730                         unsafe { o.contents.result = std::ptr::null_mut() };
2731                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { result }
2732                 } else {
2733                         let err = unsafe { o.contents.err };
2734                         unsafe { o.contents.err = std::ptr::null_mut(); }
2735                         CResult_ChannelMonitorUpdateDecodeErrorZPtr { err }
2736                 };
2737                 Self {
2738                         contents,
2739                         result_ok: o.result_ok,
2740                 }
2741         }
2742 }
2743 impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ {
2744         fn clone(&self) -> Self {
2745                 if self.result_ok {
2746                         Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2747                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::ChannelMonitorUpdate>::clone(unsafe { &*self.contents.result })))
2748                         } }
2749                 } else {
2750                         Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr {
2751                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2752                         } }
2753                 }
2754         }
2755 }
2756 #[no_mangle]
2757 pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { orig.clone() }
2758 #[repr(C)]
2759 pub union CResult_HTLCUpdateDecodeErrorZPtr {
2760         pub result: *mut crate::chain::channelmonitor::HTLCUpdate,
2761         pub err: *mut crate::ln::msgs::DecodeError,
2762 }
2763 #[repr(C)]
2764 pub struct CResult_HTLCUpdateDecodeErrorZ {
2765         pub contents: CResult_HTLCUpdateDecodeErrorZPtr,
2766         pub result_ok: bool,
2767 }
2768 #[no_mangle]
2769 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ {
2770         CResult_HTLCUpdateDecodeErrorZ {
2771                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2772                         result: Box::into_raw(Box::new(o)),
2773                 },
2774                 result_ok: true,
2775         }
2776 }
2777 #[no_mangle]
2778 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ {
2779         CResult_HTLCUpdateDecodeErrorZ {
2780                 contents: CResult_HTLCUpdateDecodeErrorZPtr {
2781                         err: Box::into_raw(Box::new(e)),
2782                 },
2783                 result_ok: false,
2784         }
2785 }
2786 #[no_mangle]
2787 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { }
2788 impl Drop for CResult_HTLCUpdateDecodeErrorZ {
2789         fn drop(&mut self) {
2790                 if self.result_ok {
2791                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
2792                                 let _ = unsafe { Box::from_raw(self.contents.result) };
2793                         }
2794                 } else {
2795                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2796                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2797                         }
2798                 }
2799         }
2800 }
2801 impl From<crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>> for CResult_HTLCUpdateDecodeErrorZ {
2802         fn from(mut o: crate::c_types::CResultTempl<crate::chain::channelmonitor::HTLCUpdate, crate::ln::msgs::DecodeError>) -> Self {
2803                 let contents = if o.result_ok {
2804                         let result = unsafe { o.contents.result };
2805                         unsafe { o.contents.result = std::ptr::null_mut() };
2806                         CResult_HTLCUpdateDecodeErrorZPtr { result }
2807                 } else {
2808                         let err = unsafe { o.contents.err };
2809                         unsafe { o.contents.err = std::ptr::null_mut(); }
2810                         CResult_HTLCUpdateDecodeErrorZPtr { err }
2811                 };
2812                 Self {
2813                         contents,
2814                         result_ok: o.result_ok,
2815                 }
2816         }
2817 }
2818 impl Clone for CResult_HTLCUpdateDecodeErrorZ {
2819         fn clone(&self) -> Self {
2820                 if self.result_ok {
2821                         Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2822                                 result: Box::into_raw(Box::new(<crate::chain::channelmonitor::HTLCUpdate>::clone(unsafe { &*self.contents.result })))
2823                         } }
2824                 } else {
2825                         Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr {
2826                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
2827                         } }
2828                 }
2829         }
2830 }
2831 #[no_mangle]
2832 pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { orig.clone() }
2833 #[repr(C)]
2834 pub union CResult_NoneMonitorUpdateErrorZPtr {
2835         /// Note that this value is always NULL, as there are no contents in the OK variant
2836         pub result: *mut std::ffi::c_void,
2837         pub err: *mut crate::chain::channelmonitor::MonitorUpdateError,
2838 }
2839 #[repr(C)]
2840 pub struct CResult_NoneMonitorUpdateErrorZ {
2841         pub contents: CResult_NoneMonitorUpdateErrorZPtr,
2842         pub result_ok: bool,
2843 }
2844 #[no_mangle]
2845 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_ok() -> CResult_NoneMonitorUpdateErrorZ {
2846         CResult_NoneMonitorUpdateErrorZ {
2847                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2848                         result: std::ptr::null_mut(),
2849                 },
2850                 result_ok: true,
2851         }
2852 }
2853 #[no_mangle]
2854 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::chain::channelmonitor::MonitorUpdateError) -> CResult_NoneMonitorUpdateErrorZ {
2855         CResult_NoneMonitorUpdateErrorZ {
2856                 contents: CResult_NoneMonitorUpdateErrorZPtr {
2857                         err: Box::into_raw(Box::new(e)),
2858                 },
2859                 result_ok: false,
2860         }
2861 }
2862 #[no_mangle]
2863 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { }
2864 impl Drop for CResult_NoneMonitorUpdateErrorZ {
2865         fn drop(&mut self) {
2866                 if self.result_ok {
2867                 } else {
2868                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
2869                                 let _ = unsafe { Box::from_raw(self.contents.err) };
2870                         }
2871                 }
2872         }
2873 }
2874 impl From<crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>> for CResult_NoneMonitorUpdateErrorZ {
2875         fn from(mut o: crate::c_types::CResultTempl<u8, crate::chain::channelmonitor::MonitorUpdateError>) -> Self {
2876                 let contents = if o.result_ok {
2877                         let _ = unsafe { Box::from_raw(o.contents.result) };
2878                         o.contents.result = std::ptr::null_mut();
2879                         CResult_NoneMonitorUpdateErrorZPtr { result: std::ptr::null_mut() }
2880                 } else {
2881                         let err = unsafe { o.contents.err };
2882                         unsafe { o.contents.err = std::ptr::null_mut(); }
2883                         CResult_NoneMonitorUpdateErrorZPtr { err }
2884                 };
2885                 Self {
2886                         contents,
2887                         result_ok: o.result_ok,
2888                 }
2889         }
2890 }
2891 impl Clone for CResult_NoneMonitorUpdateErrorZ {
2892         fn clone(&self) -> Self {
2893                 if self.result_ok {
2894                         Self { result_ok: true, contents: CResult_NoneMonitorUpdateErrorZPtr {
2895                                 result: std::ptr::null_mut()
2896                         } }
2897                 } else {
2898                         Self { result_ok: false, contents: CResult_NoneMonitorUpdateErrorZPtr {
2899                                 err: Box::into_raw(Box::new(<crate::chain::channelmonitor::MonitorUpdateError>::clone(unsafe { &*self.contents.err })))
2900                         } }
2901                 }
2902         }
2903 }
2904 #[no_mangle]
2905 pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_clone(orig: &CResult_NoneMonitorUpdateErrorZ) -> CResult_NoneMonitorUpdateErrorZ { orig.clone() }
2906 #[repr(C)]
2907 pub struct C2Tuple_OutPointScriptZ {
2908         pub a: crate::chain::transaction::OutPoint,
2909         pub b: crate::c_types::derived::CVec_u8Z,
2910 }
2911 impl From<(crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ {
2912         fn from (tup: (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self {
2913                 Self {
2914                         a: tup.0,
2915                         b: tup.1,
2916                 }
2917         }
2918 }
2919 impl C2Tuple_OutPointScriptZ {
2920         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) {
2921                 (self.a, self.b)
2922         }
2923 }
2924 impl Clone for C2Tuple_OutPointScriptZ {
2925         fn clone(&self) -> Self {
2926                 Self {
2927                         a: self.a.clone(),
2928                         b: self.b.clone(),
2929                 }
2930         }
2931 }
2932 #[no_mangle]
2933 pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { orig.clone() }
2934 #[no_mangle]
2935 pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ {
2936         C2Tuple_OutPointScriptZ { a, b, }
2937 }
2938
2939 #[no_mangle]
2940 pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { }
2941 #[repr(C)]
2942 pub struct C2Tuple_u32ScriptZ {
2943         pub a: u32,
2944         pub b: crate::c_types::derived::CVec_u8Z,
2945 }
2946 impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ {
2947         fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self {
2948                 Self {
2949                         a: tup.0,
2950                         b: tup.1,
2951                 }
2952         }
2953 }
2954 impl C2Tuple_u32ScriptZ {
2955         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) {
2956                 (self.a, self.b)
2957         }
2958 }
2959 impl Clone for C2Tuple_u32ScriptZ {
2960         fn clone(&self) -> Self {
2961                 Self {
2962                         a: self.a.clone(),
2963                         b: self.b.clone(),
2964                 }
2965         }
2966 }
2967 #[no_mangle]
2968 pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { orig.clone() }
2969 #[no_mangle]
2970 pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ {
2971         C2Tuple_u32ScriptZ { a, b, }
2972 }
2973
2974 #[no_mangle]
2975 pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { }
2976 #[repr(C)]
2977 pub struct CVec_C2Tuple_u32ScriptZZ {
2978         pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ,
2979         pub datalen: usize
2980 }
2981 impl CVec_C2Tuple_u32ScriptZZ {
2982         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32ScriptZ> {
2983                 if self.datalen == 0 { return Vec::new(); }
2984                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
2985                 self.data = std::ptr::null_mut();
2986                 self.datalen = 0;
2987                 ret
2988         }
2989         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] {
2990                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
2991         }
2992 }
2993 impl From<Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>> for CVec_C2Tuple_u32ScriptZZ {
2994         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32ScriptZ>) -> Self {
2995                 let datalen = v.len();
2996                 let data = Box::into_raw(v.into_boxed_slice());
2997                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
2998         }
2999 }
3000 #[no_mangle]
3001 pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { }
3002 impl Drop for CVec_C2Tuple_u32ScriptZZ {
3003         fn drop(&mut self) {
3004                 if self.datalen == 0 { return; }
3005                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3006         }
3007 }
3008 impl Clone for CVec_C2Tuple_u32ScriptZZ {
3009         fn clone(&self) -> Self {
3010                 let mut res = Vec::new();
3011                 if self.datalen == 0 { return Self::from(res); }
3012                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3013                 Self::from(res)
3014         }
3015 }
3016 #[repr(C)]
3017 pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3018         pub a: crate::c_types::ThirtyTwoBytes,
3019         pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ,
3020 }
3021 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3022         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self {
3023                 Self {
3024                         a: tup.0,
3025                         b: tup.1,
3026                 }
3027         }
3028 }
3029 impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3030         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) {
3031                 (self.a, self.b)
3032         }
3033 }
3034 #[no_mangle]
3035 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
3036         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, }
3037 }
3038
3039 #[no_mangle]
3040 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { }
3041 #[repr(C)]
3042 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3043         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ,
3044         pub datalen: usize
3045 }
3046 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3047         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ> {
3048                 if self.datalen == 0 { return Vec::new(); }
3049                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3050                 self.data = std::ptr::null_mut();
3051                 self.datalen = 0;
3052                 ret
3053         }
3054         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] {
3055                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3056         }
3057 }
3058 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3059         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ>) -> Self {
3060                 let datalen = v.len();
3061                 let data = Box::into_raw(v.into_boxed_slice());
3062                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3063         }
3064 }
3065 #[no_mangle]
3066 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { }
3067 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
3068         fn drop(&mut self) {
3069                 if self.datalen == 0 { return; }
3070                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3071         }
3072 }
3073 #[repr(C)]
3074 pub struct CVec_TransactionZ {
3075         pub data: *mut crate::c_types::Transaction,
3076         pub datalen: usize
3077 }
3078 impl CVec_TransactionZ {
3079         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::Transaction> {
3080                 if self.datalen == 0 { return Vec::new(); }
3081                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3082                 self.data = std::ptr::null_mut();
3083                 self.datalen = 0;
3084                 ret
3085         }
3086         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] {
3087                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3088         }
3089 }
3090 impl From<Vec<crate::c_types::Transaction>> for CVec_TransactionZ {
3091         fn from(v: Vec<crate::c_types::Transaction>) -> Self {
3092                 let datalen = v.len();
3093                 let data = Box::into_raw(v.into_boxed_slice());
3094                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3095         }
3096 }
3097 #[no_mangle]
3098 pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { }
3099 impl Drop for CVec_TransactionZ {
3100         fn drop(&mut self) {
3101                 if self.datalen == 0 { return; }
3102                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3103         }
3104 }
3105 #[repr(C)]
3106 pub struct C2Tuple_u32TxOutZ {
3107         pub a: u32,
3108         pub b: crate::c_types::TxOut,
3109 }
3110 impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ {
3111         fn from (tup: (u32, crate::c_types::TxOut)) -> Self {
3112                 Self {
3113                         a: tup.0,
3114                         b: tup.1,
3115                 }
3116         }
3117 }
3118 impl C2Tuple_u32TxOutZ {
3119         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) {
3120                 (self.a, self.b)
3121         }
3122 }
3123 impl Clone for C2Tuple_u32TxOutZ {
3124         fn clone(&self) -> Self {
3125                 Self {
3126                         a: self.a.clone(),
3127                         b: self.b.clone(),
3128                 }
3129         }
3130 }
3131 #[no_mangle]
3132 pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { orig.clone() }
3133 #[no_mangle]
3134 pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ {
3135         C2Tuple_u32TxOutZ { a, b, }
3136 }
3137
3138 #[no_mangle]
3139 pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { }
3140 #[repr(C)]
3141 pub struct CVec_C2Tuple_u32TxOutZZ {
3142         pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ,
3143         pub datalen: usize
3144 }
3145 impl CVec_C2Tuple_u32TxOutZZ {
3146         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_u32TxOutZ> {
3147                 if self.datalen == 0 { return Vec::new(); }
3148                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3149                 self.data = std::ptr::null_mut();
3150                 self.datalen = 0;
3151                 ret
3152         }
3153         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] {
3154                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3155         }
3156 }
3157 impl From<Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>> for CVec_C2Tuple_u32TxOutZZ {
3158         fn from(v: Vec<crate::c_types::derived::C2Tuple_u32TxOutZ>) -> Self {
3159                 let datalen = v.len();
3160                 let data = Box::into_raw(v.into_boxed_slice());
3161                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3162         }
3163 }
3164 #[no_mangle]
3165 pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { }
3166 impl Drop for CVec_C2Tuple_u32TxOutZZ {
3167         fn drop(&mut self) {
3168                 if self.datalen == 0 { return; }
3169                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3170         }
3171 }
3172 impl Clone for CVec_C2Tuple_u32TxOutZZ {
3173         fn clone(&self) -> Self {
3174                 let mut res = Vec::new();
3175                 if self.datalen == 0 { return Self::from(res); }
3176                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3177                 Self::from(res)
3178         }
3179 }
3180 #[repr(C)]
3181 pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3182         pub a: crate::c_types::ThirtyTwoBytes,
3183         pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ,
3184 }
3185 impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3186         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self {
3187                 Self {
3188                         a: tup.0,
3189                         b: tup.1,
3190                 }
3191         }
3192 }
3193 impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
3194         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) {
3195                 (self.a, self.b)
3196         }
3197 }
3198 #[no_mangle]
3199 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 {
3200         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, }
3201 }
3202
3203 #[no_mangle]
3204 pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { }
3205 #[repr(C)]
3206 pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3207         pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ,
3208         pub datalen: usize
3209 }
3210 impl CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3211         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ> {
3212                 if self.datalen == 0 { return Vec::new(); }
3213                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3214                 self.data = std::ptr::null_mut();
3215                 self.datalen = 0;
3216                 ret
3217         }
3218         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] {
3219                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3220         }
3221 }
3222 impl From<Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>> for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3223         fn from(v: Vec<crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ>) -> Self {
3224                 let datalen = v.len();
3225                 let data = Box::into_raw(v.into_boxed_slice());
3226                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3227         }
3228 }
3229 #[no_mangle]
3230 pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ) { }
3231 impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ {
3232         fn drop(&mut self) {
3233                 if self.datalen == 0 { return; }
3234                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3235         }
3236 }
3237 #[repr(C)]
3238 pub struct C2Tuple_BlockHashChannelMonitorZ {
3239         pub a: crate::c_types::ThirtyTwoBytes,
3240         pub b: crate::chain::channelmonitor::ChannelMonitor,
3241 }
3242 impl From<(crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)> for C2Tuple_BlockHashChannelMonitorZ {
3243         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor)) -> Self {
3244                 Self {
3245                         a: tup.0,
3246                         b: tup.1,
3247                 }
3248         }
3249 }
3250 impl C2Tuple_BlockHashChannelMonitorZ {
3251         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::chain::channelmonitor::ChannelMonitor) {
3252                 (self.a, self.b)
3253         }
3254 }
3255 #[no_mangle]
3256 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::chain::channelmonitor::ChannelMonitor) -> C2Tuple_BlockHashChannelMonitorZ {
3257         C2Tuple_BlockHashChannelMonitorZ { a, b, }
3258 }
3259
3260 #[no_mangle]
3261 pub extern "C" fn C2Tuple_BlockHashChannelMonitorZ_free(_res: C2Tuple_BlockHashChannelMonitorZ) { }
3262 #[repr(C)]
3263 pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3264         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ,
3265         pub err: *mut crate::ln::msgs::DecodeError,
3266 }
3267 #[repr(C)]
3268 pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3269         pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr,
3270         pub result_ok: bool,
3271 }
3272 #[no_mangle]
3273 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3274         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3275                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3276                         result: Box::into_raw(Box::new(o)),
3277                 },
3278                 result_ok: true,
3279         }
3280 }
3281 #[no_mangle]
3282 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3283         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3284                 contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
3285                         err: Box::into_raw(Box::new(e)),
3286                 },
3287                 result_ok: false,
3288         }
3289 }
3290 #[no_mangle]
3291 pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { }
3292 impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3293         fn drop(&mut self) {
3294                 if self.result_ok {
3295                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3296                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3297                         }
3298                 } else {
3299                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3300                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3301                         }
3302                 }
3303         }
3304 }
3305 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
3306         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, crate::ln::msgs::DecodeError>) -> Self {
3307                 let contents = if o.result_ok {
3308                         let result = unsafe { o.contents.result };
3309                         unsafe { o.contents.result = std::ptr::null_mut() };
3310                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result }
3311                 } else {
3312                         let err = unsafe { o.contents.err };
3313                         unsafe { o.contents.err = std::ptr::null_mut(); }
3314                         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err }
3315                 };
3316                 Self {
3317                         contents,
3318                         result_ok: o.result_ok,
3319                 }
3320         }
3321 }
3322 #[repr(C)]
3323 pub struct CVec_SpendableOutputDescriptorZ {
3324         pub data: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
3325         pub datalen: usize
3326 }
3327 impl CVec_SpendableOutputDescriptorZ {
3328         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::keysinterface::SpendableOutputDescriptor> {
3329                 if self.datalen == 0 { return Vec::new(); }
3330                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3331                 self.data = std::ptr::null_mut();
3332                 self.datalen = 0;
3333                 ret
3334         }
3335         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::keysinterface::SpendableOutputDescriptor] {
3336                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3337         }
3338 }
3339 impl From<Vec<crate::chain::keysinterface::SpendableOutputDescriptor>> for CVec_SpendableOutputDescriptorZ {
3340         fn from(v: Vec<crate::chain::keysinterface::SpendableOutputDescriptor>) -> Self {
3341                 let datalen = v.len();
3342                 let data = Box::into_raw(v.into_boxed_slice());
3343                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3344         }
3345 }
3346 #[no_mangle]
3347 pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { }
3348 impl Drop for CVec_SpendableOutputDescriptorZ {
3349         fn drop(&mut self) {
3350                 if self.datalen == 0 { return; }
3351                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3352         }
3353 }
3354 impl Clone for CVec_SpendableOutputDescriptorZ {
3355         fn clone(&self) -> Self {
3356                 let mut res = Vec::new();
3357                 if self.datalen == 0 { return Self::from(res); }
3358                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3359                 Self::from(res)
3360         }
3361 }
3362 #[repr(C)]
3363 pub union CResult_TxOutAccessErrorZPtr {
3364         pub result: *mut crate::c_types::TxOut,
3365         pub err: *mut crate::chain::AccessError,
3366 }
3367 #[repr(C)]
3368 pub struct CResult_TxOutAccessErrorZ {
3369         pub contents: CResult_TxOutAccessErrorZPtr,
3370         pub result_ok: bool,
3371 }
3372 #[no_mangle]
3373 pub extern "C" fn CResult_TxOutAccessErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutAccessErrorZ {
3374         CResult_TxOutAccessErrorZ {
3375                 contents: CResult_TxOutAccessErrorZPtr {
3376                         result: Box::into_raw(Box::new(o)),
3377                 },
3378                 result_ok: true,
3379         }
3380 }
3381 #[no_mangle]
3382 pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::chain::AccessError) -> CResult_TxOutAccessErrorZ {
3383         CResult_TxOutAccessErrorZ {
3384                 contents: CResult_TxOutAccessErrorZPtr {
3385                         err: Box::into_raw(Box::new(e)),
3386                 },
3387                 result_ok: false,
3388         }
3389 }
3390 #[no_mangle]
3391 pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { }
3392 impl Drop for CResult_TxOutAccessErrorZ {
3393         fn drop(&mut self) {
3394                 if self.result_ok {
3395                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3396                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3397                         }
3398                 } else {
3399                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3400                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3401                         }
3402                 }
3403         }
3404 }
3405 impl From<crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>> for CResult_TxOutAccessErrorZ {
3406         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::TxOut, crate::chain::AccessError>) -> Self {
3407                 let contents = if o.result_ok {
3408                         let result = unsafe { o.contents.result };
3409                         unsafe { o.contents.result = std::ptr::null_mut() };
3410                         CResult_TxOutAccessErrorZPtr { result }
3411                 } else {
3412                         let err = unsafe { o.contents.err };
3413                         unsafe { o.contents.err = std::ptr::null_mut(); }
3414                         CResult_TxOutAccessErrorZPtr { err }
3415                 };
3416                 Self {
3417                         contents,
3418                         result_ok: o.result_ok,
3419                 }
3420         }
3421 }
3422 impl Clone for CResult_TxOutAccessErrorZ {
3423         fn clone(&self) -> Self {
3424                 if self.result_ok {
3425                         Self { result_ok: true, contents: CResult_TxOutAccessErrorZPtr {
3426                                 result: Box::into_raw(Box::new(<crate::c_types::TxOut>::clone(unsafe { &*self.contents.result })))
3427                         } }
3428                 } else {
3429                         Self { result_ok: false, contents: CResult_TxOutAccessErrorZPtr {
3430                                 err: Box::into_raw(Box::new(<crate::chain::AccessError>::clone(unsafe { &*self.contents.err })))
3431                         } }
3432                 }
3433         }
3434 }
3435 #[no_mangle]
3436 pub extern "C" fn CResult_TxOutAccessErrorZ_clone(orig: &CResult_TxOutAccessErrorZ) -> CResult_TxOutAccessErrorZ { orig.clone() }
3437 #[repr(C)]
3438 pub enum COption_C2Tuple_usizeTransactionZZ {
3439         Some(crate::c_types::derived::C2Tuple_usizeTransactionZ),
3440         None
3441 }
3442 impl COption_C2Tuple_usizeTransactionZZ {
3443         #[allow(unused)] pub(crate) fn is_some(&self) -> bool {
3444                 if let Self::Some(_) = self { true } else { false }
3445         }
3446         #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_usizeTransactionZ {
3447                 if let Self::Some(v) = self { v } else { unreachable!() }
3448         }
3449 }
3450 #[no_mangle]
3451 pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_usizeTransactionZZ) { }
3452 #[repr(C)]
3453 pub union CResult_NoneAPIErrorZPtr {
3454         /// Note that this value is always NULL, as there are no contents in the OK variant
3455         pub result: *mut std::ffi::c_void,
3456         pub err: *mut crate::util::errors::APIError,
3457 }
3458 #[repr(C)]
3459 pub struct CResult_NoneAPIErrorZ {
3460         pub contents: CResult_NoneAPIErrorZPtr,
3461         pub result_ok: bool,
3462 }
3463 #[no_mangle]
3464 pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ {
3465         CResult_NoneAPIErrorZ {
3466                 contents: CResult_NoneAPIErrorZPtr {
3467                         result: std::ptr::null_mut(),
3468                 },
3469                 result_ok: true,
3470         }
3471 }
3472 #[no_mangle]
3473 pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::util::errors::APIError) -> CResult_NoneAPIErrorZ {
3474         CResult_NoneAPIErrorZ {
3475                 contents: CResult_NoneAPIErrorZPtr {
3476                         err: Box::into_raw(Box::new(e)),
3477                 },
3478                 result_ok: false,
3479         }
3480 }
3481 #[no_mangle]
3482 pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { }
3483 impl Drop for CResult_NoneAPIErrorZ {
3484         fn drop(&mut self) {
3485                 if self.result_ok {
3486                 } else {
3487                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3488                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3489                         }
3490                 }
3491         }
3492 }
3493 impl From<crate::c_types::CResultTempl<u8, crate::util::errors::APIError>> for CResult_NoneAPIErrorZ {
3494         fn from(mut o: crate::c_types::CResultTempl<u8, crate::util::errors::APIError>) -> Self {
3495                 let contents = if o.result_ok {
3496                         let _ = unsafe { Box::from_raw(o.contents.result) };
3497                         o.contents.result = std::ptr::null_mut();
3498                         CResult_NoneAPIErrorZPtr { result: std::ptr::null_mut() }
3499                 } else {
3500                         let err = unsafe { o.contents.err };
3501                         unsafe { o.contents.err = std::ptr::null_mut(); }
3502                         CResult_NoneAPIErrorZPtr { err }
3503                 };
3504                 Self {
3505                         contents,
3506                         result_ok: o.result_ok,
3507                 }
3508         }
3509 }
3510 impl Clone for CResult_NoneAPIErrorZ {
3511         fn clone(&self) -> Self {
3512                 if self.result_ok {
3513                         Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr {
3514                                 result: std::ptr::null_mut()
3515                         } }
3516                 } else {
3517                         Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr {
3518                                 err: Box::into_raw(Box::new(<crate::util::errors::APIError>::clone(unsafe { &*self.contents.err })))
3519                         } }
3520                 }
3521         }
3522 }
3523 #[no_mangle]
3524 pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { orig.clone() }
3525 #[repr(C)]
3526 pub struct CVec_CResult_NoneAPIErrorZZ {
3527         pub data: *mut crate::c_types::derived::CResult_NoneAPIErrorZ,
3528         pub datalen: usize
3529 }
3530 impl CVec_CResult_NoneAPIErrorZZ {
3531         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CResult_NoneAPIErrorZ> {
3532                 if self.datalen == 0 { return Vec::new(); }
3533                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3534                 self.data = std::ptr::null_mut();
3535                 self.datalen = 0;
3536                 ret
3537         }
3538         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CResult_NoneAPIErrorZ] {
3539                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3540         }
3541 }
3542 impl From<Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>> for CVec_CResult_NoneAPIErrorZZ {
3543         fn from(v: Vec<crate::c_types::derived::CResult_NoneAPIErrorZ>) -> Self {
3544                 let datalen = v.len();
3545                 let data = Box::into_raw(v.into_boxed_slice());
3546                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3547         }
3548 }
3549 #[no_mangle]
3550 pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { }
3551 impl Drop for CVec_CResult_NoneAPIErrorZZ {
3552         fn drop(&mut self) {
3553                 if self.datalen == 0 { return; }
3554                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3555         }
3556 }
3557 impl Clone for CVec_CResult_NoneAPIErrorZZ {
3558         fn clone(&self) -> Self {
3559                 let mut res = Vec::new();
3560                 if self.datalen == 0 { return Self::from(res); }
3561                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3562                 Self::from(res)
3563         }
3564 }
3565 #[repr(C)]
3566 pub struct CVec_APIErrorZ {
3567         pub data: *mut crate::util::errors::APIError,
3568         pub datalen: usize
3569 }
3570 impl CVec_APIErrorZ {
3571         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::util::errors::APIError> {
3572                 if self.datalen == 0 { return Vec::new(); }
3573                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3574                 self.data = std::ptr::null_mut();
3575                 self.datalen = 0;
3576                 ret
3577         }
3578         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::util::errors::APIError] {
3579                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3580         }
3581 }
3582 impl From<Vec<crate::util::errors::APIError>> for CVec_APIErrorZ {
3583         fn from(v: Vec<crate::util::errors::APIError>) -> Self {
3584                 let datalen = v.len();
3585                 let data = Box::into_raw(v.into_boxed_slice());
3586                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3587         }
3588 }
3589 #[no_mangle]
3590 pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { }
3591 impl Drop for CVec_APIErrorZ {
3592         fn drop(&mut self) {
3593                 if self.datalen == 0 { return; }
3594                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3595         }
3596 }
3597 impl Clone for CVec_APIErrorZ {
3598         fn clone(&self) -> Self {
3599                 let mut res = Vec::new();
3600                 if self.datalen == 0 { return Self::from(res); }
3601                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3602                 Self::from(res)
3603         }
3604 }
3605 #[repr(C)]
3606 pub struct CVec_ChannelDetailsZ {
3607         pub data: *mut crate::ln::channelmanager::ChannelDetails,
3608         pub datalen: usize
3609 }
3610 impl CVec_ChannelDetailsZ {
3611         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::channelmanager::ChannelDetails> {
3612                 if self.datalen == 0 { return Vec::new(); }
3613                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3614                 self.data = std::ptr::null_mut();
3615                 self.datalen = 0;
3616                 ret
3617         }
3618         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::channelmanager::ChannelDetails] {
3619                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3620         }
3621 }
3622 impl From<Vec<crate::ln::channelmanager::ChannelDetails>> for CVec_ChannelDetailsZ {
3623         fn from(v: Vec<crate::ln::channelmanager::ChannelDetails>) -> Self {
3624                 let datalen = v.len();
3625                 let data = Box::into_raw(v.into_boxed_slice());
3626                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3627         }
3628 }
3629 #[no_mangle]
3630 pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { }
3631 impl Drop for CVec_ChannelDetailsZ {
3632         fn drop(&mut self) {
3633                 if self.datalen == 0 { return; }
3634                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3635         }
3636 }
3637 impl Clone for CVec_ChannelDetailsZ {
3638         fn clone(&self) -> Self {
3639                 let mut res = Vec::new();
3640                 if self.datalen == 0 { return Self::from(res); }
3641                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
3642                 Self::from(res)
3643         }
3644 }
3645 #[repr(C)]
3646 pub union CResult_NonePaymentSendFailureZPtr {
3647         /// Note that this value is always NULL, as there are no contents in the OK variant
3648         pub result: *mut std::ffi::c_void,
3649         pub err: *mut crate::ln::channelmanager::PaymentSendFailure,
3650 }
3651 #[repr(C)]
3652 pub struct CResult_NonePaymentSendFailureZ {
3653         pub contents: CResult_NonePaymentSendFailureZPtr,
3654         pub result_ok: bool,
3655 }
3656 #[no_mangle]
3657 pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ {
3658         CResult_NonePaymentSendFailureZ {
3659                 contents: CResult_NonePaymentSendFailureZPtr {
3660                         result: std::ptr::null_mut(),
3661                 },
3662                 result_ok: true,
3663         }
3664 }
3665 #[no_mangle]
3666 pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::ln::channelmanager::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ {
3667         CResult_NonePaymentSendFailureZ {
3668                 contents: CResult_NonePaymentSendFailureZPtr {
3669                         err: Box::into_raw(Box::new(e)),
3670                 },
3671                 result_ok: false,
3672         }
3673 }
3674 #[no_mangle]
3675 pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { }
3676 impl Drop for CResult_NonePaymentSendFailureZ {
3677         fn drop(&mut self) {
3678                 if self.result_ok {
3679                 } else {
3680                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3681                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3682                         }
3683                 }
3684         }
3685 }
3686 impl From<crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>> for CResult_NonePaymentSendFailureZ {
3687         fn from(mut o: crate::c_types::CResultTempl<u8, crate::ln::channelmanager::PaymentSendFailure>) -> Self {
3688                 let contents = if o.result_ok {
3689                         let _ = unsafe { Box::from_raw(o.contents.result) };
3690                         o.contents.result = std::ptr::null_mut();
3691                         CResult_NonePaymentSendFailureZPtr { result: std::ptr::null_mut() }
3692                 } else {
3693                         let err = unsafe { o.contents.err };
3694                         unsafe { o.contents.err = std::ptr::null_mut(); }
3695                         CResult_NonePaymentSendFailureZPtr { err }
3696                 };
3697                 Self {
3698                         contents,
3699                         result_ok: o.result_ok,
3700                 }
3701         }
3702 }
3703 impl Clone for CResult_NonePaymentSendFailureZ {
3704         fn clone(&self) -> Self {
3705                 if self.result_ok {
3706                         Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr {
3707                                 result: std::ptr::null_mut()
3708                         } }
3709                 } else {
3710                         Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr {
3711                                 err: Box::into_raw(Box::new(<crate::ln::channelmanager::PaymentSendFailure>::clone(unsafe { &*self.contents.err })))
3712                         } }
3713                 }
3714         }
3715 }
3716 #[no_mangle]
3717 pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { orig.clone() }
3718 #[repr(C)]
3719 pub struct CVec_ChannelMonitorZ {
3720         pub data: *mut crate::chain::channelmonitor::ChannelMonitor,
3721         pub datalen: usize
3722 }
3723 impl CVec_ChannelMonitorZ {
3724         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::chain::channelmonitor::ChannelMonitor> {
3725                 if self.datalen == 0 { return Vec::new(); }
3726                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
3727                 self.data = std::ptr::null_mut();
3728                 self.datalen = 0;
3729                 ret
3730         }
3731         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::chain::channelmonitor::ChannelMonitor] {
3732                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
3733         }
3734 }
3735 impl From<Vec<crate::chain::channelmonitor::ChannelMonitor>> for CVec_ChannelMonitorZ {
3736         fn from(v: Vec<crate::chain::channelmonitor::ChannelMonitor>) -> Self {
3737                 let datalen = v.len();
3738                 let data = Box::into_raw(v.into_boxed_slice());
3739                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
3740         }
3741 }
3742 #[no_mangle]
3743 pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { }
3744 impl Drop for CVec_ChannelMonitorZ {
3745         fn drop(&mut self) {
3746                 if self.datalen == 0 { return; }
3747                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
3748         }
3749 }
3750 #[repr(C)]
3751 pub struct C2Tuple_BlockHashChannelManagerZ {
3752         pub a: crate::c_types::ThirtyTwoBytes,
3753         pub b: crate::ln::channelmanager::ChannelManager,
3754 }
3755 impl From<(crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)> for C2Tuple_BlockHashChannelManagerZ {
3756         fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager)) -> Self {
3757                 Self {
3758                         a: tup.0,
3759                         b: tup.1,
3760                 }
3761         }
3762 }
3763 impl C2Tuple_BlockHashChannelManagerZ {
3764         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::ln::channelmanager::ChannelManager) {
3765                 (self.a, self.b)
3766         }
3767 }
3768 #[no_mangle]
3769 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::ln::channelmanager::ChannelManager) -> C2Tuple_BlockHashChannelManagerZ {
3770         C2Tuple_BlockHashChannelManagerZ { a, b, }
3771 }
3772
3773 #[no_mangle]
3774 pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_free(_res: C2Tuple_BlockHashChannelManagerZ) { }
3775 #[repr(C)]
3776 pub union CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3777         pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ,
3778         pub err: *mut crate::ln::msgs::DecodeError,
3779 }
3780 #[repr(C)]
3781 pub struct CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3782         pub contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr,
3783         pub result_ok: bool,
3784 }
3785 #[no_mangle]
3786 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3787         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3788                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3789                         result: Box::into_raw(Box::new(o)),
3790                 },
3791                 result_ok: true,
3792         }
3793 }
3794 #[no_mangle]
3795 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3796         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3797                 contents: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
3798                         err: Box::into_raw(Box::new(e)),
3799                 },
3800                 result_ok: false,
3801         }
3802 }
3803 #[no_mangle]
3804 pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { }
3805 impl Drop for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3806         fn drop(&mut self) {
3807                 if self.result_ok {
3808                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3809                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3810                         }
3811                 } else {
3812                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3813                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3814                         }
3815                 }
3816         }
3817 }
3818 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>> for CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
3819         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ, crate::ln::msgs::DecodeError>) -> Self {
3820                 let contents = if o.result_ok {
3821                         let result = unsafe { o.contents.result };
3822                         unsafe { o.contents.result = std::ptr::null_mut() };
3823                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { result }
3824                 } else {
3825                         let err = unsafe { o.contents.err };
3826                         unsafe { o.contents.err = std::ptr::null_mut(); }
3827                         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { err }
3828                 };
3829                 Self {
3830                         contents,
3831                         result_ok: o.result_ok,
3832                 }
3833         }
3834 }
3835 #[repr(C)]
3836 pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3837         pub result: *mut crate::chain::keysinterface::SpendableOutputDescriptor,
3838         pub err: *mut crate::ln::msgs::DecodeError,
3839 }
3840 #[repr(C)]
3841 pub struct CResult_SpendableOutputDescriptorDecodeErrorZ {
3842         pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr,
3843         pub result_ok: bool,
3844 }
3845 #[no_mangle]
3846 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::chain::keysinterface::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3847         CResult_SpendableOutputDescriptorDecodeErrorZ {
3848                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3849                         result: Box::into_raw(Box::new(o)),
3850                 },
3851                 result_ok: true,
3852         }
3853 }
3854 #[no_mangle]
3855 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ {
3856         CResult_SpendableOutputDescriptorDecodeErrorZ {
3857                 contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3858                         err: Box::into_raw(Box::new(e)),
3859                 },
3860                 result_ok: false,
3861         }
3862 }
3863 #[no_mangle]
3864 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { }
3865 impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ {
3866         fn drop(&mut self) {
3867                 if self.result_ok {
3868                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3869                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3870                         }
3871                 } else {
3872                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
3873                                 let _ = unsafe { Box::from_raw(self.contents.err) };
3874                         }
3875                 }
3876         }
3877 }
3878 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>> for CResult_SpendableOutputDescriptorDecodeErrorZ {
3879         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::SpendableOutputDescriptor, crate::ln::msgs::DecodeError>) -> Self {
3880                 let contents = if o.result_ok {
3881                         let result = unsafe { o.contents.result };
3882                         unsafe { o.contents.result = std::ptr::null_mut() };
3883                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { result }
3884                 } else {
3885                         let err = unsafe { o.contents.err };
3886                         unsafe { o.contents.err = std::ptr::null_mut(); }
3887                         CResult_SpendableOutputDescriptorDecodeErrorZPtr { err }
3888                 };
3889                 Self {
3890                         contents,
3891                         result_ok: o.result_ok,
3892                 }
3893         }
3894 }
3895 impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ {
3896         fn clone(&self) -> Self {
3897                 if self.result_ok {
3898                         Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3899                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::SpendableOutputDescriptor>::clone(unsafe { &*self.contents.result })))
3900                         } }
3901                 } else {
3902                         Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr {
3903                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
3904                         } }
3905                 }
3906         }
3907 }
3908 #[no_mangle]
3909 pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { orig.clone() }
3910 #[repr(C)]
3911 pub struct C2Tuple_SignatureCVec_SignatureZZ {
3912         pub a: crate::c_types::Signature,
3913         pub b: crate::c_types::derived::CVec_SignatureZ,
3914 }
3915 impl From<(crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)> for C2Tuple_SignatureCVec_SignatureZZ {
3916         fn from (tup: (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ)) -> Self {
3917                 Self {
3918                         a: tup.0,
3919                         b: tup.1,
3920                 }
3921         }
3922 }
3923 impl C2Tuple_SignatureCVec_SignatureZZ {
3924         #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Signature, crate::c_types::derived::CVec_SignatureZ) {
3925                 (self.a, self.b)
3926         }
3927 }
3928 impl Clone for C2Tuple_SignatureCVec_SignatureZZ {
3929         fn clone(&self) -> Self {
3930                 Self {
3931                         a: self.a.clone(),
3932                         b: self.b.clone(),
3933                 }
3934         }
3935 }
3936 #[no_mangle]
3937 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_clone(orig: &C2Tuple_SignatureCVec_SignatureZZ) -> C2Tuple_SignatureCVec_SignatureZZ { orig.clone() }
3938 #[no_mangle]
3939 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_new(a: crate::c_types::Signature, b: crate::c_types::derived::CVec_SignatureZ) -> C2Tuple_SignatureCVec_SignatureZZ {
3940         C2Tuple_SignatureCVec_SignatureZZ { a, b, }
3941 }
3942
3943 #[no_mangle]
3944 pub extern "C" fn C2Tuple_SignatureCVec_SignatureZZ_free(_res: C2Tuple_SignatureCVec_SignatureZZ) { }
3945 #[repr(C)]
3946 pub union CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3947         pub result: *mut crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ,
3948         /// Note that this value is always NULL, as there are no contents in the Err variant
3949         pub err: *mut std::ffi::c_void,
3950 }
3951 #[repr(C)]
3952 pub struct CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3953         pub contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr,
3954         pub result_ok: bool,
3955 }
3956 #[no_mangle]
3957 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3958         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3959                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3960                         result: Box::into_raw(Box::new(o)),
3961                 },
3962                 result_ok: true,
3963         }
3964 }
3965 #[no_mangle]
3966 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3967         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3968                 contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3969                         err: std::ptr::null_mut(),
3970                 },
3971                 result_ok: false,
3972         }
3973 }
3974 #[no_mangle]
3975 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { }
3976 impl Drop for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3977         fn drop(&mut self) {
3978                 if self.result_ok {
3979                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
3980                                 let _ = unsafe { Box::from_raw(self.contents.result) };
3981                         }
3982                 } else {
3983                 }
3984         }
3985 }
3986 impl From<crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>> for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3987         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ, u8>) -> Self {
3988                 let contents = if o.result_ok {
3989                         let result = unsafe { o.contents.result };
3990                         unsafe { o.contents.result = std::ptr::null_mut() };
3991                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { result }
3992                 } else {
3993                         let _ = unsafe { Box::from_raw(o.contents.err) };
3994                         o.contents.err = std::ptr::null_mut();
3995                         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { err: std::ptr::null_mut() }
3996                 };
3997                 Self {
3998                         contents,
3999                         result_ok: o.result_ok,
4000                 }
4001         }
4002 }
4003 impl Clone for CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4004         fn clone(&self) -> Self {
4005                 if self.result_ok {
4006                         Self { result_ok: true, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4007                                 result: Box::into_raw(Box::new(<crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ>::clone(unsafe { &*self.contents.result })))
4008                         } }
4009                 } else {
4010                         Self { result_ok: false, contents: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4011                                 err: std::ptr::null_mut()
4012                         } }
4013                 }
4014         }
4015 }
4016 #[no_mangle]
4017 pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { orig.clone() }
4018 #[repr(C)]
4019 pub union CResult_SignatureNoneZPtr {
4020         pub result: *mut crate::c_types::Signature,
4021         /// Note that this value is always NULL, as there are no contents in the Err variant
4022         pub err: *mut std::ffi::c_void,
4023 }
4024 #[repr(C)]
4025 pub struct CResult_SignatureNoneZ {
4026         pub contents: CResult_SignatureNoneZPtr,
4027         pub result_ok: bool,
4028 }
4029 #[no_mangle]
4030 pub extern "C" fn CResult_SignatureNoneZ_ok(o: crate::c_types::Signature) -> CResult_SignatureNoneZ {
4031         CResult_SignatureNoneZ {
4032                 contents: CResult_SignatureNoneZPtr {
4033                         result: Box::into_raw(Box::new(o)),
4034                 },
4035                 result_ok: true,
4036         }
4037 }
4038 #[no_mangle]
4039 pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ {
4040         CResult_SignatureNoneZ {
4041                 contents: CResult_SignatureNoneZPtr {
4042                         err: std::ptr::null_mut(),
4043                 },
4044                 result_ok: false,
4045         }
4046 }
4047 #[no_mangle]
4048 pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { }
4049 impl Drop for CResult_SignatureNoneZ {
4050         fn drop(&mut self) {
4051                 if self.result_ok {
4052                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4053                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4054                         }
4055                 } else {
4056                 }
4057         }
4058 }
4059 impl From<crate::c_types::CResultTempl<crate::c_types::Signature, u8>> for CResult_SignatureNoneZ {
4060         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Signature, u8>) -> Self {
4061                 let contents = if o.result_ok {
4062                         let result = unsafe { o.contents.result };
4063                         unsafe { o.contents.result = std::ptr::null_mut() };
4064                         CResult_SignatureNoneZPtr { result }
4065                 } else {
4066                         let _ = unsafe { Box::from_raw(o.contents.err) };
4067                         o.contents.err = std::ptr::null_mut();
4068                         CResult_SignatureNoneZPtr { err: std::ptr::null_mut() }
4069                 };
4070                 Self {
4071                         contents,
4072                         result_ok: o.result_ok,
4073                 }
4074         }
4075 }
4076 impl Clone for CResult_SignatureNoneZ {
4077         fn clone(&self) -> Self {
4078                 if self.result_ok {
4079                         Self { result_ok: true, contents: CResult_SignatureNoneZPtr {
4080                                 result: Box::into_raw(Box::new(<crate::c_types::Signature>::clone(unsafe { &*self.contents.result })))
4081                         } }
4082                 } else {
4083                         Self { result_ok: false, contents: CResult_SignatureNoneZPtr {
4084                                 err: std::ptr::null_mut()
4085                         } }
4086                 }
4087         }
4088 }
4089 #[no_mangle]
4090 pub extern "C" fn CResult_SignatureNoneZ_clone(orig: &CResult_SignatureNoneZ) -> CResult_SignatureNoneZ { orig.clone() }
4091 #[repr(C)]
4092 pub union CResult_SignDecodeErrorZPtr {
4093         pub result: *mut crate::chain::keysinterface::Sign,
4094         pub err: *mut crate::ln::msgs::DecodeError,
4095 }
4096 #[repr(C)]
4097 pub struct CResult_SignDecodeErrorZ {
4098         pub contents: CResult_SignDecodeErrorZPtr,
4099         pub result_ok: bool,
4100 }
4101 #[no_mangle]
4102 pub extern "C" fn CResult_SignDecodeErrorZ_ok(o: crate::chain::keysinterface::Sign) -> CResult_SignDecodeErrorZ {
4103         CResult_SignDecodeErrorZ {
4104                 contents: CResult_SignDecodeErrorZPtr {
4105                         result: Box::into_raw(Box::new(o)),
4106                 },
4107                 result_ok: true,
4108         }
4109 }
4110 #[no_mangle]
4111 pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_SignDecodeErrorZ {
4112         CResult_SignDecodeErrorZ {
4113                 contents: CResult_SignDecodeErrorZPtr {
4114                         err: Box::into_raw(Box::new(e)),
4115                 },
4116                 result_ok: false,
4117         }
4118 }
4119 #[no_mangle]
4120 pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { }
4121 impl Drop for CResult_SignDecodeErrorZ {
4122         fn drop(&mut self) {
4123                 if self.result_ok {
4124                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4125                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4126                         }
4127                 } else {
4128                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4129                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4130                         }
4131                 }
4132         }
4133 }
4134 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>> for CResult_SignDecodeErrorZ {
4135         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::Sign, crate::ln::msgs::DecodeError>) -> Self {
4136                 let contents = if o.result_ok {
4137                         let result = unsafe { o.contents.result };
4138                         unsafe { o.contents.result = std::ptr::null_mut() };
4139                         CResult_SignDecodeErrorZPtr { result }
4140                 } else {
4141                         let err = unsafe { o.contents.err };
4142                         unsafe { o.contents.err = std::ptr::null_mut(); }
4143                         CResult_SignDecodeErrorZPtr { err }
4144                 };
4145                 Self {
4146                         contents,
4147                         result_ok: o.result_ok,
4148                 }
4149         }
4150 }
4151 impl Clone for CResult_SignDecodeErrorZ {
4152         fn clone(&self) -> Self {
4153                 if self.result_ok {
4154                         Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr {
4155                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::Sign>::clone(unsafe { &*self.contents.result })))
4156                         } }
4157                 } else {
4158                         Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr {
4159                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4160                         } }
4161                 }
4162         }
4163 }
4164 #[no_mangle]
4165 pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { orig.clone() }
4166 #[repr(C)]
4167 pub struct CVec_CVec_u8ZZ {
4168         pub data: *mut crate::c_types::derived::CVec_u8Z,
4169         pub datalen: usize
4170 }
4171 impl CVec_CVec_u8ZZ {
4172         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_u8Z> {
4173                 if self.datalen == 0 { return Vec::new(); }
4174                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4175                 self.data = std::ptr::null_mut();
4176                 self.datalen = 0;
4177                 ret
4178         }
4179         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] {
4180                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4181         }
4182 }
4183 impl From<Vec<crate::c_types::derived::CVec_u8Z>> for CVec_CVec_u8ZZ {
4184         fn from(v: Vec<crate::c_types::derived::CVec_u8Z>) -> Self {
4185                 let datalen = v.len();
4186                 let data = Box::into_raw(v.into_boxed_slice());
4187                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4188         }
4189 }
4190 #[no_mangle]
4191 pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { }
4192 impl Drop for CVec_CVec_u8ZZ {
4193         fn drop(&mut self) {
4194                 if self.datalen == 0 { return; }
4195                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4196         }
4197 }
4198 impl Clone for CVec_CVec_u8ZZ {
4199         fn clone(&self) -> Self {
4200                 let mut res = Vec::new();
4201                 if self.datalen == 0 { return Self::from(res); }
4202                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4203                 Self::from(res)
4204         }
4205 }
4206 #[repr(C)]
4207 pub union CResult_CVec_CVec_u8ZZNoneZPtr {
4208         pub result: *mut crate::c_types::derived::CVec_CVec_u8ZZ,
4209         /// Note that this value is always NULL, as there are no contents in the Err variant
4210         pub err: *mut std::ffi::c_void,
4211 }
4212 #[repr(C)]
4213 pub struct CResult_CVec_CVec_u8ZZNoneZ {
4214         pub contents: CResult_CVec_CVec_u8ZZNoneZPtr,
4215         pub result_ok: bool,
4216 }
4217 #[no_mangle]
4218 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_ok(o: crate::c_types::derived::CVec_CVec_u8ZZ) -> CResult_CVec_CVec_u8ZZNoneZ {
4219         CResult_CVec_CVec_u8ZZNoneZ {
4220                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4221                         result: Box::into_raw(Box::new(o)),
4222                 },
4223                 result_ok: true,
4224         }
4225 }
4226 #[no_mangle]
4227 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNoneZ {
4228         CResult_CVec_CVec_u8ZZNoneZ {
4229                 contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4230                         err: std::ptr::null_mut(),
4231                 },
4232                 result_ok: false,
4233         }
4234 }
4235 #[no_mangle]
4236 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { }
4237 impl Drop for CResult_CVec_CVec_u8ZZNoneZ {
4238         fn drop(&mut self) {
4239                 if self.result_ok {
4240                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4241                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4242                         }
4243                 } else {
4244                 }
4245         }
4246 }
4247 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>> for CResult_CVec_CVec_u8ZZNoneZ {
4248         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CVec_CVec_u8ZZ, u8>) -> Self {
4249                 let contents = if o.result_ok {
4250                         let result = unsafe { o.contents.result };
4251                         unsafe { o.contents.result = std::ptr::null_mut() };
4252                         CResult_CVec_CVec_u8ZZNoneZPtr { result }
4253                 } else {
4254                         let _ = unsafe { Box::from_raw(o.contents.err) };
4255                         o.contents.err = std::ptr::null_mut();
4256                         CResult_CVec_CVec_u8ZZNoneZPtr { err: std::ptr::null_mut() }
4257                 };
4258                 Self {
4259                         contents,
4260                         result_ok: o.result_ok,
4261                 }
4262         }
4263 }
4264 impl Clone for CResult_CVec_CVec_u8ZZNoneZ {
4265         fn clone(&self) -> Self {
4266                 if self.result_ok {
4267                         Self { result_ok: true, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4268                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CVec_CVec_u8ZZ>::clone(unsafe { &*self.contents.result })))
4269                         } }
4270                 } else {
4271                         Self { result_ok: false, contents: CResult_CVec_CVec_u8ZZNoneZPtr {
4272                                 err: std::ptr::null_mut()
4273                         } }
4274                 }
4275         }
4276 }
4277 #[no_mangle]
4278 pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_clone(orig: &CResult_CVec_CVec_u8ZZNoneZ) -> CResult_CVec_CVec_u8ZZNoneZ { orig.clone() }
4279 #[repr(C)]
4280 pub union CResult_InMemorySignerDecodeErrorZPtr {
4281         pub result: *mut crate::chain::keysinterface::InMemorySigner,
4282         pub err: *mut crate::ln::msgs::DecodeError,
4283 }
4284 #[repr(C)]
4285 pub struct CResult_InMemorySignerDecodeErrorZ {
4286         pub contents: CResult_InMemorySignerDecodeErrorZPtr,
4287         pub result_ok: bool,
4288 }
4289 #[no_mangle]
4290 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::chain::keysinterface::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ {
4291         CResult_InMemorySignerDecodeErrorZ {
4292                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4293                         result: Box::into_raw(Box::new(o)),
4294                 },
4295                 result_ok: true,
4296         }
4297 }
4298 #[no_mangle]
4299 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ {
4300         CResult_InMemorySignerDecodeErrorZ {
4301                 contents: CResult_InMemorySignerDecodeErrorZPtr {
4302                         err: Box::into_raw(Box::new(e)),
4303                 },
4304                 result_ok: false,
4305         }
4306 }
4307 #[no_mangle]
4308 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { }
4309 impl Drop for CResult_InMemorySignerDecodeErrorZ {
4310         fn drop(&mut self) {
4311                 if self.result_ok {
4312                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4313                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4314                         }
4315                 } else {
4316                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4317                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4318                         }
4319                 }
4320         }
4321 }
4322 impl From<crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>> for CResult_InMemorySignerDecodeErrorZ {
4323         fn from(mut o: crate::c_types::CResultTempl<crate::chain::keysinterface::InMemorySigner, crate::ln::msgs::DecodeError>) -> Self {
4324                 let contents = if o.result_ok {
4325                         let result = unsafe { o.contents.result };
4326                         unsafe { o.contents.result = std::ptr::null_mut() };
4327                         CResult_InMemorySignerDecodeErrorZPtr { result }
4328                 } else {
4329                         let err = unsafe { o.contents.err };
4330                         unsafe { o.contents.err = std::ptr::null_mut(); }
4331                         CResult_InMemorySignerDecodeErrorZPtr { err }
4332                 };
4333                 Self {
4334                         contents,
4335                         result_ok: o.result_ok,
4336                 }
4337         }
4338 }
4339 impl Clone for CResult_InMemorySignerDecodeErrorZ {
4340         fn clone(&self) -> Self {
4341                 if self.result_ok {
4342                         Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr {
4343                                 result: Box::into_raw(Box::new(<crate::chain::keysinterface::InMemorySigner>::clone(unsafe { &*self.contents.result })))
4344                         } }
4345                 } else {
4346                         Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr {
4347                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4348                         } }
4349                 }
4350         }
4351 }
4352 #[no_mangle]
4353 pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { orig.clone() }
4354 #[repr(C)]
4355 pub struct CVec_TxOutZ {
4356         pub data: *mut crate::c_types::TxOut,
4357         pub datalen: usize
4358 }
4359 impl CVec_TxOutZ {
4360         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::TxOut> {
4361                 if self.datalen == 0 { return Vec::new(); }
4362                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4363                 self.data = std::ptr::null_mut();
4364                 self.datalen = 0;
4365                 ret
4366         }
4367         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::TxOut] {
4368                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4369         }
4370 }
4371 impl From<Vec<crate::c_types::TxOut>> for CVec_TxOutZ {
4372         fn from(v: Vec<crate::c_types::TxOut>) -> Self {
4373                 let datalen = v.len();
4374                 let data = Box::into_raw(v.into_boxed_slice());
4375                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4376         }
4377 }
4378 #[no_mangle]
4379 pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { }
4380 impl Drop for CVec_TxOutZ {
4381         fn drop(&mut self) {
4382                 if self.datalen == 0 { return; }
4383                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4384         }
4385 }
4386 impl Clone for CVec_TxOutZ {
4387         fn clone(&self) -> Self {
4388                 let mut res = Vec::new();
4389                 if self.datalen == 0 { return Self::from(res); }
4390                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4391                 Self::from(res)
4392         }
4393 }
4394 #[repr(C)]
4395 pub union CResult_TransactionNoneZPtr {
4396         pub result: *mut crate::c_types::Transaction,
4397         /// Note that this value is always NULL, as there are no contents in the Err variant
4398         pub err: *mut std::ffi::c_void,
4399 }
4400 #[repr(C)]
4401 pub struct CResult_TransactionNoneZ {
4402         pub contents: CResult_TransactionNoneZPtr,
4403         pub result_ok: bool,
4404 }
4405 #[no_mangle]
4406 pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ {
4407         CResult_TransactionNoneZ {
4408                 contents: CResult_TransactionNoneZPtr {
4409                         result: Box::into_raw(Box::new(o)),
4410                 },
4411                 result_ok: true,
4412         }
4413 }
4414 #[no_mangle]
4415 pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ {
4416         CResult_TransactionNoneZ {
4417                 contents: CResult_TransactionNoneZPtr {
4418                         err: std::ptr::null_mut(),
4419                 },
4420                 result_ok: false,
4421         }
4422 }
4423 #[no_mangle]
4424 pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { }
4425 impl Drop for CResult_TransactionNoneZ {
4426         fn drop(&mut self) {
4427                 if self.result_ok {
4428                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4429                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4430                         }
4431                 } else {
4432                 }
4433         }
4434 }
4435 impl From<crate::c_types::CResultTempl<crate::c_types::Transaction, u8>> for CResult_TransactionNoneZ {
4436         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::Transaction, u8>) -> Self {
4437                 let contents = if o.result_ok {
4438                         let result = unsafe { o.contents.result };
4439                         unsafe { o.contents.result = std::ptr::null_mut() };
4440                         CResult_TransactionNoneZPtr { result }
4441                 } else {
4442                         let _ = unsafe { Box::from_raw(o.contents.err) };
4443                         o.contents.err = std::ptr::null_mut();
4444                         CResult_TransactionNoneZPtr { err: std::ptr::null_mut() }
4445                 };
4446                 Self {
4447                         contents,
4448                         result_ok: o.result_ok,
4449                 }
4450         }
4451 }
4452 #[repr(C)]
4453 pub struct CVec_RouteHopZ {
4454         pub data: *mut crate::routing::router::RouteHop,
4455         pub datalen: usize
4456 }
4457 impl CVec_RouteHopZ {
4458         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHop> {
4459                 if self.datalen == 0 { return Vec::new(); }
4460                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4461                 self.data = std::ptr::null_mut();
4462                 self.datalen = 0;
4463                 ret
4464         }
4465         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHop] {
4466                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4467         }
4468 }
4469 impl From<Vec<crate::routing::router::RouteHop>> for CVec_RouteHopZ {
4470         fn from(v: Vec<crate::routing::router::RouteHop>) -> Self {
4471                 let datalen = v.len();
4472                 let data = Box::into_raw(v.into_boxed_slice());
4473                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4474         }
4475 }
4476 #[no_mangle]
4477 pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { }
4478 impl Drop for CVec_RouteHopZ {
4479         fn drop(&mut self) {
4480                 if self.datalen == 0 { return; }
4481                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4482         }
4483 }
4484 impl Clone for CVec_RouteHopZ {
4485         fn clone(&self) -> Self {
4486                 let mut res = Vec::new();
4487                 if self.datalen == 0 { return Self::from(res); }
4488                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4489                 Self::from(res)
4490         }
4491 }
4492 #[repr(C)]
4493 pub struct CVec_CVec_RouteHopZZ {
4494         pub data: *mut crate::c_types::derived::CVec_RouteHopZ,
4495         pub datalen: usize
4496 }
4497 impl CVec_CVec_RouteHopZZ {
4498         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::c_types::derived::CVec_RouteHopZ> {
4499                 if self.datalen == 0 { return Vec::new(); }
4500                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4501                 self.data = std::ptr::null_mut();
4502                 self.datalen = 0;
4503                 ret
4504         }
4505         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_RouteHopZ] {
4506                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4507         }
4508 }
4509 impl From<Vec<crate::c_types::derived::CVec_RouteHopZ>> for CVec_CVec_RouteHopZZ {
4510         fn from(v: Vec<crate::c_types::derived::CVec_RouteHopZ>) -> Self {
4511                 let datalen = v.len();
4512                 let data = Box::into_raw(v.into_boxed_slice());
4513                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4514         }
4515 }
4516 #[no_mangle]
4517 pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { }
4518 impl Drop for CVec_CVec_RouteHopZZ {
4519         fn drop(&mut self) {
4520                 if self.datalen == 0 { return; }
4521                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4522         }
4523 }
4524 impl Clone for CVec_CVec_RouteHopZZ {
4525         fn clone(&self) -> Self {
4526                 let mut res = Vec::new();
4527                 if self.datalen == 0 { return Self::from(res); }
4528                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4529                 Self::from(res)
4530         }
4531 }
4532 #[repr(C)]
4533 pub union CResult_RouteDecodeErrorZPtr {
4534         pub result: *mut crate::routing::router::Route,
4535         pub err: *mut crate::ln::msgs::DecodeError,
4536 }
4537 #[repr(C)]
4538 pub struct CResult_RouteDecodeErrorZ {
4539         pub contents: CResult_RouteDecodeErrorZPtr,
4540         pub result_ok: bool,
4541 }
4542 #[no_mangle]
4543 pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteDecodeErrorZ {
4544         CResult_RouteDecodeErrorZ {
4545                 contents: CResult_RouteDecodeErrorZPtr {
4546                         result: Box::into_raw(Box::new(o)),
4547                 },
4548                 result_ok: true,
4549         }
4550 }
4551 #[no_mangle]
4552 pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ {
4553         CResult_RouteDecodeErrorZ {
4554                 contents: CResult_RouteDecodeErrorZPtr {
4555                         err: Box::into_raw(Box::new(e)),
4556                 },
4557                 result_ok: false,
4558         }
4559 }
4560 #[no_mangle]
4561 pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { }
4562 impl Drop for CResult_RouteDecodeErrorZ {
4563         fn drop(&mut self) {
4564                 if self.result_ok {
4565                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4566                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4567                         }
4568                 } else {
4569                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4570                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4571                         }
4572                 }
4573         }
4574 }
4575 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>> for CResult_RouteDecodeErrorZ {
4576         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::DecodeError>) -> Self {
4577                 let contents = if o.result_ok {
4578                         let result = unsafe { o.contents.result };
4579                         unsafe { o.contents.result = std::ptr::null_mut() };
4580                         CResult_RouteDecodeErrorZPtr { result }
4581                 } else {
4582                         let err = unsafe { o.contents.err };
4583                         unsafe { o.contents.err = std::ptr::null_mut(); }
4584                         CResult_RouteDecodeErrorZPtr { err }
4585                 };
4586                 Self {
4587                         contents,
4588                         result_ok: o.result_ok,
4589                 }
4590         }
4591 }
4592 impl Clone for CResult_RouteDecodeErrorZ {
4593         fn clone(&self) -> Self {
4594                 if self.result_ok {
4595                         Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr {
4596                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4597                         } }
4598                 } else {
4599                         Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr {
4600                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4601                         } }
4602                 }
4603         }
4604 }
4605 #[no_mangle]
4606 pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { orig.clone() }
4607 #[repr(C)]
4608 pub struct CVec_RouteHintZ {
4609         pub data: *mut crate::routing::router::RouteHint,
4610         pub datalen: usize
4611 }
4612 impl CVec_RouteHintZ {
4613         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::routing::router::RouteHint> {
4614                 if self.datalen == 0 { return Vec::new(); }
4615                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4616                 self.data = std::ptr::null_mut();
4617                 self.datalen = 0;
4618                 ret
4619         }
4620         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::routing::router::RouteHint] {
4621                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4622         }
4623 }
4624 impl From<Vec<crate::routing::router::RouteHint>> for CVec_RouteHintZ {
4625         fn from(v: Vec<crate::routing::router::RouteHint>) -> Self {
4626                 let datalen = v.len();
4627                 let data = Box::into_raw(v.into_boxed_slice());
4628                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4629         }
4630 }
4631 #[no_mangle]
4632 pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { }
4633 impl Drop for CVec_RouteHintZ {
4634         fn drop(&mut self) {
4635                 if self.datalen == 0 { return; }
4636                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4637         }
4638 }
4639 impl Clone for CVec_RouteHintZ {
4640         fn clone(&self) -> Self {
4641                 let mut res = Vec::new();
4642                 if self.datalen == 0 { return Self::from(res); }
4643                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4644                 Self::from(res)
4645         }
4646 }
4647 #[repr(C)]
4648 pub union CResult_RouteLightningErrorZPtr {
4649         pub result: *mut crate::routing::router::Route,
4650         pub err: *mut crate::ln::msgs::LightningError,
4651 }
4652 #[repr(C)]
4653 pub struct CResult_RouteLightningErrorZ {
4654         pub contents: CResult_RouteLightningErrorZPtr,
4655         pub result_ok: bool,
4656 }
4657 #[no_mangle]
4658 pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::routing::router::Route) -> CResult_RouteLightningErrorZ {
4659         CResult_RouteLightningErrorZ {
4660                 contents: CResult_RouteLightningErrorZPtr {
4661                         result: Box::into_raw(Box::new(o)),
4662                 },
4663                 result_ok: true,
4664         }
4665 }
4666 #[no_mangle]
4667 pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ {
4668         CResult_RouteLightningErrorZ {
4669                 contents: CResult_RouteLightningErrorZPtr {
4670                         err: Box::into_raw(Box::new(e)),
4671                 },
4672                 result_ok: false,
4673         }
4674 }
4675 #[no_mangle]
4676 pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { }
4677 impl Drop for CResult_RouteLightningErrorZ {
4678         fn drop(&mut self) {
4679                 if self.result_ok {
4680                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4681                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4682                         }
4683                 } else {
4684                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4685                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4686                         }
4687                 }
4688         }
4689 }
4690 impl From<crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>> for CResult_RouteLightningErrorZ {
4691         fn from(mut o: crate::c_types::CResultTempl<crate::routing::router::Route, crate::ln::msgs::LightningError>) -> Self {
4692                 let contents = if o.result_ok {
4693                         let result = unsafe { o.contents.result };
4694                         unsafe { o.contents.result = std::ptr::null_mut() };
4695                         CResult_RouteLightningErrorZPtr { result }
4696                 } else {
4697                         let err = unsafe { o.contents.err };
4698                         unsafe { o.contents.err = std::ptr::null_mut(); }
4699                         CResult_RouteLightningErrorZPtr { err }
4700                 };
4701                 Self {
4702                         contents,
4703                         result_ok: o.result_ok,
4704                 }
4705         }
4706 }
4707 impl Clone for CResult_RouteLightningErrorZ {
4708         fn clone(&self) -> Self {
4709                 if self.result_ok {
4710                         Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr {
4711                                 result: Box::into_raw(Box::new(<crate::routing::router::Route>::clone(unsafe { &*self.contents.result })))
4712                         } }
4713                 } else {
4714                         Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr {
4715                                 err: Box::into_raw(Box::new(<crate::ln::msgs::LightningError>::clone(unsafe { &*self.contents.err })))
4716                         } }
4717                 }
4718         }
4719 }
4720 #[no_mangle]
4721 pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { orig.clone() }
4722 #[repr(C)]
4723 pub union CResult_NetAddressu8ZPtr {
4724         pub result: *mut crate::ln::msgs::NetAddress,
4725         pub err: *mut u8,
4726 }
4727 #[repr(C)]
4728 pub struct CResult_NetAddressu8Z {
4729         pub contents: CResult_NetAddressu8ZPtr,
4730         pub result_ok: bool,
4731 }
4732 #[no_mangle]
4733 pub extern "C" fn CResult_NetAddressu8Z_ok(o: crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z {
4734         CResult_NetAddressu8Z {
4735                 contents: CResult_NetAddressu8ZPtr {
4736                         result: Box::into_raw(Box::new(o)),
4737                 },
4738                 result_ok: true,
4739         }
4740 }
4741 #[no_mangle]
4742 pub extern "C" fn CResult_NetAddressu8Z_err(e: u8) -> CResult_NetAddressu8Z {
4743         CResult_NetAddressu8Z {
4744                 contents: CResult_NetAddressu8ZPtr {
4745                         err: Box::into_raw(Box::new(e)),
4746                 },
4747                 result_ok: false,
4748         }
4749 }
4750 #[no_mangle]
4751 pub extern "C" fn CResult_NetAddressu8Z_free(_res: CResult_NetAddressu8Z) { }
4752 impl Drop for CResult_NetAddressu8Z {
4753         fn drop(&mut self) {
4754                 if self.result_ok {
4755                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4756                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4757                         }
4758                 } else {
4759                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4760                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4761                         }
4762                 }
4763         }
4764 }
4765 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>> for CResult_NetAddressu8Z {
4766         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NetAddress, u8>) -> Self {
4767                 let contents = if o.result_ok {
4768                         let result = unsafe { o.contents.result };
4769                         unsafe { o.contents.result = std::ptr::null_mut() };
4770                         CResult_NetAddressu8ZPtr { result }
4771                 } else {
4772                         let err = unsafe { o.contents.err };
4773                         unsafe { o.contents.err = std::ptr::null_mut(); }
4774                         CResult_NetAddressu8ZPtr { err }
4775                 };
4776                 Self {
4777                         contents,
4778                         result_ok: o.result_ok,
4779                 }
4780         }
4781 }
4782 impl Clone for CResult_NetAddressu8Z {
4783         fn clone(&self) -> Self {
4784                 if self.result_ok {
4785                         Self { result_ok: true, contents: CResult_NetAddressu8ZPtr {
4786                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NetAddress>::clone(unsafe { &*self.contents.result })))
4787                         } }
4788                 } else {
4789                         Self { result_ok: false, contents: CResult_NetAddressu8ZPtr {
4790                                 err: Box::into_raw(Box::new(<u8>::clone(unsafe { &*self.contents.err })))
4791                         } }
4792                 }
4793         }
4794 }
4795 #[no_mangle]
4796 pub extern "C" fn CResult_NetAddressu8Z_clone(orig: &CResult_NetAddressu8Z) -> CResult_NetAddressu8Z { orig.clone() }
4797 #[repr(C)]
4798 pub union CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4799         pub result: *mut crate::c_types::derived::CResult_NetAddressu8Z,
4800         pub err: *mut crate::ln::msgs::DecodeError,
4801 }
4802 #[repr(C)]
4803 pub struct CResult_CResult_NetAddressu8ZDecodeErrorZ {
4804         pub contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr,
4805         pub result_ok: bool,
4806 }
4807 #[no_mangle]
4808 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o: crate::c_types::derived::CResult_NetAddressu8Z) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4809         CResult_CResult_NetAddressu8ZDecodeErrorZ {
4810                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4811                         result: Box::into_raw(Box::new(o)),
4812                 },
4813                 result_ok: true,
4814         }
4815 }
4816 #[no_mangle]
4817 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CResult_NetAddressu8ZDecodeErrorZ {
4818         CResult_CResult_NetAddressu8ZDecodeErrorZ {
4819                 contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4820                         err: Box::into_raw(Box::new(e)),
4821                 },
4822                 result_ok: false,
4823         }
4824 }
4825 #[no_mangle]
4826 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res: CResult_CResult_NetAddressu8ZDecodeErrorZ) { }
4827 impl Drop for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4828         fn drop(&mut self) {
4829                 if self.result_ok {
4830                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
4831                                 let _ = unsafe { Box::from_raw(self.contents.result) };
4832                         }
4833                 } else {
4834                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
4835                                 let _ = unsafe { Box::from_raw(self.contents.err) };
4836                         }
4837                 }
4838         }
4839 }
4840 impl From<crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>> for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4841         fn from(mut o: crate::c_types::CResultTempl<crate::c_types::derived::CResult_NetAddressu8Z, crate::ln::msgs::DecodeError>) -> Self {
4842                 let contents = if o.result_ok {
4843                         let result = unsafe { o.contents.result };
4844                         unsafe { o.contents.result = std::ptr::null_mut() };
4845                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { result }
4846                 } else {
4847                         let err = unsafe { o.contents.err };
4848                         unsafe { o.contents.err = std::ptr::null_mut(); }
4849                         CResult_CResult_NetAddressu8ZDecodeErrorZPtr { err }
4850                 };
4851                 Self {
4852                         contents,
4853                         result_ok: o.result_ok,
4854                 }
4855         }
4856 }
4857 impl Clone for CResult_CResult_NetAddressu8ZDecodeErrorZ {
4858         fn clone(&self) -> Self {
4859                 if self.result_ok {
4860                         Self { result_ok: true, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4861                                 result: Box::into_raw(Box::new(<crate::c_types::derived::CResult_NetAddressu8Z>::clone(unsafe { &*self.contents.result })))
4862                         } }
4863                 } else {
4864                         Self { result_ok: false, contents: CResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4865                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
4866                         } }
4867                 }
4868         }
4869 }
4870 #[no_mangle]
4871 pub extern "C" fn CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig: &CResult_CResult_NetAddressu8ZDecodeErrorZ) -> CResult_CResult_NetAddressu8ZDecodeErrorZ { orig.clone() }
4872 #[repr(C)]
4873 pub struct CVec_UpdateAddHTLCZ {
4874         pub data: *mut crate::ln::msgs::UpdateAddHTLC,
4875         pub datalen: usize
4876 }
4877 impl CVec_UpdateAddHTLCZ {
4878         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateAddHTLC> {
4879                 if self.datalen == 0 { return Vec::new(); }
4880                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4881                 self.data = std::ptr::null_mut();
4882                 self.datalen = 0;
4883                 ret
4884         }
4885         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateAddHTLC] {
4886                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4887         }
4888 }
4889 impl From<Vec<crate::ln::msgs::UpdateAddHTLC>> for CVec_UpdateAddHTLCZ {
4890         fn from(v: Vec<crate::ln::msgs::UpdateAddHTLC>) -> Self {
4891                 let datalen = v.len();
4892                 let data = Box::into_raw(v.into_boxed_slice());
4893                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4894         }
4895 }
4896 #[no_mangle]
4897 pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { }
4898 impl Drop for CVec_UpdateAddHTLCZ {
4899         fn drop(&mut self) {
4900                 if self.datalen == 0 { return; }
4901                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4902         }
4903 }
4904 impl Clone for CVec_UpdateAddHTLCZ {
4905         fn clone(&self) -> Self {
4906                 let mut res = Vec::new();
4907                 if self.datalen == 0 { return Self::from(res); }
4908                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4909                 Self::from(res)
4910         }
4911 }
4912 #[repr(C)]
4913 pub struct CVec_UpdateFulfillHTLCZ {
4914         pub data: *mut crate::ln::msgs::UpdateFulfillHTLC,
4915         pub datalen: usize
4916 }
4917 impl CVec_UpdateFulfillHTLCZ {
4918         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFulfillHTLC> {
4919                 if self.datalen == 0 { return Vec::new(); }
4920                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4921                 self.data = std::ptr::null_mut();
4922                 self.datalen = 0;
4923                 ret
4924         }
4925         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFulfillHTLC] {
4926                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4927         }
4928 }
4929 impl From<Vec<crate::ln::msgs::UpdateFulfillHTLC>> for CVec_UpdateFulfillHTLCZ {
4930         fn from(v: Vec<crate::ln::msgs::UpdateFulfillHTLC>) -> Self {
4931                 let datalen = v.len();
4932                 let data = Box::into_raw(v.into_boxed_slice());
4933                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4934         }
4935 }
4936 #[no_mangle]
4937 pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { }
4938 impl Drop for CVec_UpdateFulfillHTLCZ {
4939         fn drop(&mut self) {
4940                 if self.datalen == 0 { return; }
4941                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4942         }
4943 }
4944 impl Clone for CVec_UpdateFulfillHTLCZ {
4945         fn clone(&self) -> Self {
4946                 let mut res = Vec::new();
4947                 if self.datalen == 0 { return Self::from(res); }
4948                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4949                 Self::from(res)
4950         }
4951 }
4952 #[repr(C)]
4953 pub struct CVec_UpdateFailHTLCZ {
4954         pub data: *mut crate::ln::msgs::UpdateFailHTLC,
4955         pub datalen: usize
4956 }
4957 impl CVec_UpdateFailHTLCZ {
4958         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailHTLC> {
4959                 if self.datalen == 0 { return Vec::new(); }
4960                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
4961                 self.data = std::ptr::null_mut();
4962                 self.datalen = 0;
4963                 ret
4964         }
4965         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailHTLC] {
4966                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
4967         }
4968 }
4969 impl From<Vec<crate::ln::msgs::UpdateFailHTLC>> for CVec_UpdateFailHTLCZ {
4970         fn from(v: Vec<crate::ln::msgs::UpdateFailHTLC>) -> Self {
4971                 let datalen = v.len();
4972                 let data = Box::into_raw(v.into_boxed_slice());
4973                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
4974         }
4975 }
4976 #[no_mangle]
4977 pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { }
4978 impl Drop for CVec_UpdateFailHTLCZ {
4979         fn drop(&mut self) {
4980                 if self.datalen == 0 { return; }
4981                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
4982         }
4983 }
4984 impl Clone for CVec_UpdateFailHTLCZ {
4985         fn clone(&self) -> Self {
4986                 let mut res = Vec::new();
4987                 if self.datalen == 0 { return Self::from(res); }
4988                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
4989                 Self::from(res)
4990         }
4991 }
4992 #[repr(C)]
4993 pub struct CVec_UpdateFailMalformedHTLCZ {
4994         pub data: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
4995         pub datalen: usize
4996 }
4997 impl CVec_UpdateFailMalformedHTLCZ {
4998         #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<crate::ln::msgs::UpdateFailMalformedHTLC> {
4999                 if self.datalen == 0 { return Vec::new(); }
5000                 let ret = unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) }.into();
5001                 self.data = std::ptr::null_mut();
5002                 self.datalen = 0;
5003                 ret
5004         }
5005         #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::ln::msgs::UpdateFailMalformedHTLC] {
5006                 unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) }
5007         }
5008 }
5009 impl From<Vec<crate::ln::msgs::UpdateFailMalformedHTLC>> for CVec_UpdateFailMalformedHTLCZ {
5010         fn from(v: Vec<crate::ln::msgs::UpdateFailMalformedHTLC>) -> Self {
5011                 let datalen = v.len();
5012                 let data = Box::into_raw(v.into_boxed_slice());
5013                 Self { datalen, data: unsafe { (*data).as_mut_ptr() } }
5014         }
5015 }
5016 #[no_mangle]
5017 pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { }
5018 impl Drop for CVec_UpdateFailMalformedHTLCZ {
5019         fn drop(&mut self) {
5020                 if self.datalen == 0 { return; }
5021                 unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
5022         }
5023 }
5024 impl Clone for CVec_UpdateFailMalformedHTLCZ {
5025         fn clone(&self) -> Self {
5026                 let mut res = Vec::new();
5027                 if self.datalen == 0 { return Self::from(res); }
5028                 res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
5029                 Self::from(res)
5030         }
5031 }
5032 #[repr(C)]
5033 pub union CResult_AcceptChannelDecodeErrorZPtr {
5034         pub result: *mut crate::ln::msgs::AcceptChannel,
5035         pub err: *mut crate::ln::msgs::DecodeError,
5036 }
5037 #[repr(C)]
5038 pub struct CResult_AcceptChannelDecodeErrorZ {
5039         pub contents: CResult_AcceptChannelDecodeErrorZPtr,
5040         pub result_ok: bool,
5041 }
5042 #[no_mangle]
5043 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ {
5044         CResult_AcceptChannelDecodeErrorZ {
5045                 contents: CResult_AcceptChannelDecodeErrorZPtr {
5046                         result: Box::into_raw(Box::new(o)),
5047                 },
5048                 result_ok: true,
5049         }
5050 }
5051 #[no_mangle]
5052 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ {
5053         CResult_AcceptChannelDecodeErrorZ {
5054                 contents: CResult_AcceptChannelDecodeErrorZPtr {
5055                         err: Box::into_raw(Box::new(e)),
5056                 },
5057                 result_ok: false,
5058         }
5059 }
5060 #[no_mangle]
5061 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { }
5062 impl Drop for CResult_AcceptChannelDecodeErrorZ {
5063         fn drop(&mut self) {
5064                 if self.result_ok {
5065                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5066                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5067                         }
5068                 } else {
5069                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5070                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5071                         }
5072                 }
5073         }
5074 }
5075 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>> for CResult_AcceptChannelDecodeErrorZ {
5076         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AcceptChannel, crate::ln::msgs::DecodeError>) -> Self {
5077                 let contents = if o.result_ok {
5078                         let result = unsafe { o.contents.result };
5079                         unsafe { o.contents.result = std::ptr::null_mut() };
5080                         CResult_AcceptChannelDecodeErrorZPtr { result }
5081                 } else {
5082                         let err = unsafe { o.contents.err };
5083                         unsafe { o.contents.err = std::ptr::null_mut(); }
5084                         CResult_AcceptChannelDecodeErrorZPtr { err }
5085                 };
5086                 Self {
5087                         contents,
5088                         result_ok: o.result_ok,
5089                 }
5090         }
5091 }
5092 impl Clone for CResult_AcceptChannelDecodeErrorZ {
5093         fn clone(&self) -> Self {
5094                 if self.result_ok {
5095                         Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr {
5096                                 result: Box::into_raw(Box::new(<crate::ln::msgs::AcceptChannel>::clone(unsafe { &*self.contents.result })))
5097                         } }
5098                 } else {
5099                         Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr {
5100                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5101                         } }
5102                 }
5103         }
5104 }
5105 #[no_mangle]
5106 pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { orig.clone() }
5107 #[repr(C)]
5108 pub union CResult_AnnouncementSignaturesDecodeErrorZPtr {
5109         pub result: *mut crate::ln::msgs::AnnouncementSignatures,
5110         pub err: *mut crate::ln::msgs::DecodeError,
5111 }
5112 #[repr(C)]
5113 pub struct CResult_AnnouncementSignaturesDecodeErrorZ {
5114         pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr,
5115         pub result_ok: bool,
5116 }
5117 #[no_mangle]
5118 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5119         CResult_AnnouncementSignaturesDecodeErrorZ {
5120                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5121                         result: Box::into_raw(Box::new(o)),
5122                 },
5123                 result_ok: true,
5124         }
5125 }
5126 #[no_mangle]
5127 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ {
5128         CResult_AnnouncementSignaturesDecodeErrorZ {
5129                 contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5130                         err: Box::into_raw(Box::new(e)),
5131                 },
5132                 result_ok: false,
5133         }
5134 }
5135 #[no_mangle]
5136 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { }
5137 impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ {
5138         fn drop(&mut self) {
5139                 if self.result_ok {
5140                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5141                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5142                         }
5143                 } else {
5144                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5145                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5146                         }
5147                 }
5148         }
5149 }
5150 impl From<crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>> for CResult_AnnouncementSignaturesDecodeErrorZ {
5151         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::AnnouncementSignatures, crate::ln::msgs::DecodeError>) -> Self {
5152                 let contents = if o.result_ok {
5153                         let result = unsafe { o.contents.result };
5154                         unsafe { o.contents.result = std::ptr::null_mut() };
5155                         CResult_AnnouncementSignaturesDecodeErrorZPtr { result }
5156                 } else {
5157                         let err = unsafe { o.contents.err };
5158                         unsafe { o.contents.err = std::ptr::null_mut(); }
5159                         CResult_AnnouncementSignaturesDecodeErrorZPtr { err }
5160                 };
5161                 Self {
5162                         contents,
5163                         result_ok: o.result_ok,
5164                 }
5165         }
5166 }
5167 impl Clone for CResult_AnnouncementSignaturesDecodeErrorZ {
5168         fn clone(&self) -> Self {
5169                 if self.result_ok {
5170                         Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5171                                 result: Box::into_raw(Box::new(<crate::ln::msgs::AnnouncementSignatures>::clone(unsafe { &*self.contents.result })))
5172                         } }
5173                 } else {
5174                         Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr {
5175                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5176                         } }
5177                 }
5178         }
5179 }
5180 #[no_mangle]
5181 pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { orig.clone() }
5182 #[repr(C)]
5183 pub union CResult_ChannelReestablishDecodeErrorZPtr {
5184         pub result: *mut crate::ln::msgs::ChannelReestablish,
5185         pub err: *mut crate::ln::msgs::DecodeError,
5186 }
5187 #[repr(C)]
5188 pub struct CResult_ChannelReestablishDecodeErrorZ {
5189         pub contents: CResult_ChannelReestablishDecodeErrorZPtr,
5190         pub result_ok: bool,
5191 }
5192 #[no_mangle]
5193 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ {
5194         CResult_ChannelReestablishDecodeErrorZ {
5195                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
5196                         result: Box::into_raw(Box::new(o)),
5197                 },
5198                 result_ok: true,
5199         }
5200 }
5201 #[no_mangle]
5202 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ {
5203         CResult_ChannelReestablishDecodeErrorZ {
5204                 contents: CResult_ChannelReestablishDecodeErrorZPtr {
5205                         err: Box::into_raw(Box::new(e)),
5206                 },
5207                 result_ok: false,
5208         }
5209 }
5210 #[no_mangle]
5211 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { }
5212 impl Drop for CResult_ChannelReestablishDecodeErrorZ {
5213         fn drop(&mut self) {
5214                 if self.result_ok {
5215                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5216                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5217                         }
5218                 } else {
5219                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5220                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5221                         }
5222                 }
5223         }
5224 }
5225 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>> for CResult_ChannelReestablishDecodeErrorZ {
5226         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelReestablish, crate::ln::msgs::DecodeError>) -> Self {
5227                 let contents = if o.result_ok {
5228                         let result = unsafe { o.contents.result };
5229                         unsafe { o.contents.result = std::ptr::null_mut() };
5230                         CResult_ChannelReestablishDecodeErrorZPtr { result }
5231                 } else {
5232                         let err = unsafe { o.contents.err };
5233                         unsafe { o.contents.err = std::ptr::null_mut(); }
5234                         CResult_ChannelReestablishDecodeErrorZPtr { err }
5235                 };
5236                 Self {
5237                         contents,
5238                         result_ok: o.result_ok,
5239                 }
5240         }
5241 }
5242 impl Clone for CResult_ChannelReestablishDecodeErrorZ {
5243         fn clone(&self) -> Self {
5244                 if self.result_ok {
5245                         Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5246                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelReestablish>::clone(unsafe { &*self.contents.result })))
5247                         } }
5248                 } else {
5249                         Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr {
5250                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5251                         } }
5252                 }
5253         }
5254 }
5255 #[no_mangle]
5256 pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { orig.clone() }
5257 #[repr(C)]
5258 pub union CResult_ClosingSignedDecodeErrorZPtr {
5259         pub result: *mut crate::ln::msgs::ClosingSigned,
5260         pub err: *mut crate::ln::msgs::DecodeError,
5261 }
5262 #[repr(C)]
5263 pub struct CResult_ClosingSignedDecodeErrorZ {
5264         pub contents: CResult_ClosingSignedDecodeErrorZPtr,
5265         pub result_ok: bool,
5266 }
5267 #[no_mangle]
5268 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ {
5269         CResult_ClosingSignedDecodeErrorZ {
5270                 contents: CResult_ClosingSignedDecodeErrorZPtr {
5271                         result: Box::into_raw(Box::new(o)),
5272                 },
5273                 result_ok: true,
5274         }
5275 }
5276 #[no_mangle]
5277 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ {
5278         CResult_ClosingSignedDecodeErrorZ {
5279                 contents: CResult_ClosingSignedDecodeErrorZPtr {
5280                         err: Box::into_raw(Box::new(e)),
5281                 },
5282                 result_ok: false,
5283         }
5284 }
5285 #[no_mangle]
5286 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { }
5287 impl Drop for CResult_ClosingSignedDecodeErrorZ {
5288         fn drop(&mut self) {
5289                 if self.result_ok {
5290                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5291                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5292                         }
5293                 } else {
5294                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5295                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5296                         }
5297                 }
5298         }
5299 }
5300 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>> for CResult_ClosingSignedDecodeErrorZ {
5301         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ClosingSigned, crate::ln::msgs::DecodeError>) -> Self {
5302                 let contents = if o.result_ok {
5303                         let result = unsafe { o.contents.result };
5304                         unsafe { o.contents.result = std::ptr::null_mut() };
5305                         CResult_ClosingSignedDecodeErrorZPtr { result }
5306                 } else {
5307                         let err = unsafe { o.contents.err };
5308                         unsafe { o.contents.err = std::ptr::null_mut(); }
5309                         CResult_ClosingSignedDecodeErrorZPtr { err }
5310                 };
5311                 Self {
5312                         contents,
5313                         result_ok: o.result_ok,
5314                 }
5315         }
5316 }
5317 impl Clone for CResult_ClosingSignedDecodeErrorZ {
5318         fn clone(&self) -> Self {
5319                 if self.result_ok {
5320                         Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr {
5321                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ClosingSigned>::clone(unsafe { &*self.contents.result })))
5322                         } }
5323                 } else {
5324                         Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr {
5325                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5326                         } }
5327                 }
5328         }
5329 }
5330 #[no_mangle]
5331 pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { orig.clone() }
5332 #[repr(C)]
5333 pub union CResult_CommitmentSignedDecodeErrorZPtr {
5334         pub result: *mut crate::ln::msgs::CommitmentSigned,
5335         pub err: *mut crate::ln::msgs::DecodeError,
5336 }
5337 #[repr(C)]
5338 pub struct CResult_CommitmentSignedDecodeErrorZ {
5339         pub contents: CResult_CommitmentSignedDecodeErrorZPtr,
5340         pub result_ok: bool,
5341 }
5342 #[no_mangle]
5343 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ {
5344         CResult_CommitmentSignedDecodeErrorZ {
5345                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5346                         result: Box::into_raw(Box::new(o)),
5347                 },
5348                 result_ok: true,
5349         }
5350 }
5351 #[no_mangle]
5352 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ {
5353         CResult_CommitmentSignedDecodeErrorZ {
5354                 contents: CResult_CommitmentSignedDecodeErrorZPtr {
5355                         err: Box::into_raw(Box::new(e)),
5356                 },
5357                 result_ok: false,
5358         }
5359 }
5360 #[no_mangle]
5361 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { }
5362 impl Drop for CResult_CommitmentSignedDecodeErrorZ {
5363         fn drop(&mut self) {
5364                 if self.result_ok {
5365                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5366                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5367                         }
5368                 } else {
5369                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5370                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5371                         }
5372                 }
5373         }
5374 }
5375 impl From<crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>> for CResult_CommitmentSignedDecodeErrorZ {
5376         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::CommitmentSigned, crate::ln::msgs::DecodeError>) -> Self {
5377                 let contents = if o.result_ok {
5378                         let result = unsafe { o.contents.result };
5379                         unsafe { o.contents.result = std::ptr::null_mut() };
5380                         CResult_CommitmentSignedDecodeErrorZPtr { result }
5381                 } else {
5382                         let err = unsafe { o.contents.err };
5383                         unsafe { o.contents.err = std::ptr::null_mut(); }
5384                         CResult_CommitmentSignedDecodeErrorZPtr { err }
5385                 };
5386                 Self {
5387                         contents,
5388                         result_ok: o.result_ok,
5389                 }
5390         }
5391 }
5392 impl Clone for CResult_CommitmentSignedDecodeErrorZ {
5393         fn clone(&self) -> Self {
5394                 if self.result_ok {
5395                         Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5396                                 result: Box::into_raw(Box::new(<crate::ln::msgs::CommitmentSigned>::clone(unsafe { &*self.contents.result })))
5397                         } }
5398                 } else {
5399                         Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr {
5400                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5401                         } }
5402                 }
5403         }
5404 }
5405 #[no_mangle]
5406 pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { orig.clone() }
5407 #[repr(C)]
5408 pub union CResult_FundingCreatedDecodeErrorZPtr {
5409         pub result: *mut crate::ln::msgs::FundingCreated,
5410         pub err: *mut crate::ln::msgs::DecodeError,
5411 }
5412 #[repr(C)]
5413 pub struct CResult_FundingCreatedDecodeErrorZ {
5414         pub contents: CResult_FundingCreatedDecodeErrorZPtr,
5415         pub result_ok: bool,
5416 }
5417 #[no_mangle]
5418 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ {
5419         CResult_FundingCreatedDecodeErrorZ {
5420                 contents: CResult_FundingCreatedDecodeErrorZPtr {
5421                         result: Box::into_raw(Box::new(o)),
5422                 },
5423                 result_ok: true,
5424         }
5425 }
5426 #[no_mangle]
5427 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ {
5428         CResult_FundingCreatedDecodeErrorZ {
5429                 contents: CResult_FundingCreatedDecodeErrorZPtr {
5430                         err: Box::into_raw(Box::new(e)),
5431                 },
5432                 result_ok: false,
5433         }
5434 }
5435 #[no_mangle]
5436 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { }
5437 impl Drop for CResult_FundingCreatedDecodeErrorZ {
5438         fn drop(&mut self) {
5439                 if self.result_ok {
5440                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5441                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5442                         }
5443                 } else {
5444                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5445                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5446                         }
5447                 }
5448         }
5449 }
5450 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>> for CResult_FundingCreatedDecodeErrorZ {
5451         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingCreated, crate::ln::msgs::DecodeError>) -> Self {
5452                 let contents = if o.result_ok {
5453                         let result = unsafe { o.contents.result };
5454                         unsafe { o.contents.result = std::ptr::null_mut() };
5455                         CResult_FundingCreatedDecodeErrorZPtr { result }
5456                 } else {
5457                         let err = unsafe { o.contents.err };
5458                         unsafe { o.contents.err = std::ptr::null_mut(); }
5459                         CResult_FundingCreatedDecodeErrorZPtr { err }
5460                 };
5461                 Self {
5462                         contents,
5463                         result_ok: o.result_ok,
5464                 }
5465         }
5466 }
5467 impl Clone for CResult_FundingCreatedDecodeErrorZ {
5468         fn clone(&self) -> Self {
5469                 if self.result_ok {
5470                         Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr {
5471                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingCreated>::clone(unsafe { &*self.contents.result })))
5472                         } }
5473                 } else {
5474                         Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr {
5475                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5476                         } }
5477                 }
5478         }
5479 }
5480 #[no_mangle]
5481 pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { orig.clone() }
5482 #[repr(C)]
5483 pub union CResult_FundingSignedDecodeErrorZPtr {
5484         pub result: *mut crate::ln::msgs::FundingSigned,
5485         pub err: *mut crate::ln::msgs::DecodeError,
5486 }
5487 #[repr(C)]
5488 pub struct CResult_FundingSignedDecodeErrorZ {
5489         pub contents: CResult_FundingSignedDecodeErrorZPtr,
5490         pub result_ok: bool,
5491 }
5492 #[no_mangle]
5493 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ {
5494         CResult_FundingSignedDecodeErrorZ {
5495                 contents: CResult_FundingSignedDecodeErrorZPtr {
5496                         result: Box::into_raw(Box::new(o)),
5497                 },
5498                 result_ok: true,
5499         }
5500 }
5501 #[no_mangle]
5502 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ {
5503         CResult_FundingSignedDecodeErrorZ {
5504                 contents: CResult_FundingSignedDecodeErrorZPtr {
5505                         err: Box::into_raw(Box::new(e)),
5506                 },
5507                 result_ok: false,
5508         }
5509 }
5510 #[no_mangle]
5511 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { }
5512 impl Drop for CResult_FundingSignedDecodeErrorZ {
5513         fn drop(&mut self) {
5514                 if self.result_ok {
5515                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5516                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5517                         }
5518                 } else {
5519                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5520                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5521                         }
5522                 }
5523         }
5524 }
5525 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>> for CResult_FundingSignedDecodeErrorZ {
5526         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingSigned, crate::ln::msgs::DecodeError>) -> Self {
5527                 let contents = if o.result_ok {
5528                         let result = unsafe { o.contents.result };
5529                         unsafe { o.contents.result = std::ptr::null_mut() };
5530                         CResult_FundingSignedDecodeErrorZPtr { result }
5531                 } else {
5532                         let err = unsafe { o.contents.err };
5533                         unsafe { o.contents.err = std::ptr::null_mut(); }
5534                         CResult_FundingSignedDecodeErrorZPtr { err }
5535                 };
5536                 Self {
5537                         contents,
5538                         result_ok: o.result_ok,
5539                 }
5540         }
5541 }
5542 impl Clone for CResult_FundingSignedDecodeErrorZ {
5543         fn clone(&self) -> Self {
5544                 if self.result_ok {
5545                         Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr {
5546                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingSigned>::clone(unsafe { &*self.contents.result })))
5547                         } }
5548                 } else {
5549                         Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr {
5550                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5551                         } }
5552                 }
5553         }
5554 }
5555 #[no_mangle]
5556 pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { orig.clone() }
5557 #[repr(C)]
5558 pub union CResult_FundingLockedDecodeErrorZPtr {
5559         pub result: *mut crate::ln::msgs::FundingLocked,
5560         pub err: *mut crate::ln::msgs::DecodeError,
5561 }
5562 #[repr(C)]
5563 pub struct CResult_FundingLockedDecodeErrorZ {
5564         pub contents: CResult_FundingLockedDecodeErrorZPtr,
5565         pub result_ok: bool,
5566 }
5567 #[no_mangle]
5568 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ {
5569         CResult_FundingLockedDecodeErrorZ {
5570                 contents: CResult_FundingLockedDecodeErrorZPtr {
5571                         result: Box::into_raw(Box::new(o)),
5572                 },
5573                 result_ok: true,
5574         }
5575 }
5576 #[no_mangle]
5577 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ {
5578         CResult_FundingLockedDecodeErrorZ {
5579                 contents: CResult_FundingLockedDecodeErrorZPtr {
5580                         err: Box::into_raw(Box::new(e)),
5581                 },
5582                 result_ok: false,
5583         }
5584 }
5585 #[no_mangle]
5586 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { }
5587 impl Drop for CResult_FundingLockedDecodeErrorZ {
5588         fn drop(&mut self) {
5589                 if self.result_ok {
5590                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5591                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5592                         }
5593                 } else {
5594                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5595                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5596                         }
5597                 }
5598         }
5599 }
5600 impl From<crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>> for CResult_FundingLockedDecodeErrorZ {
5601         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::FundingLocked, crate::ln::msgs::DecodeError>) -> Self {
5602                 let contents = if o.result_ok {
5603                         let result = unsafe { o.contents.result };
5604                         unsafe { o.contents.result = std::ptr::null_mut() };
5605                         CResult_FundingLockedDecodeErrorZPtr { result }
5606                 } else {
5607                         let err = unsafe { o.contents.err };
5608                         unsafe { o.contents.err = std::ptr::null_mut(); }
5609                         CResult_FundingLockedDecodeErrorZPtr { err }
5610                 };
5611                 Self {
5612                         contents,
5613                         result_ok: o.result_ok,
5614                 }
5615         }
5616 }
5617 impl Clone for CResult_FundingLockedDecodeErrorZ {
5618         fn clone(&self) -> Self {
5619                 if self.result_ok {
5620                         Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr {
5621                                 result: Box::into_raw(Box::new(<crate::ln::msgs::FundingLocked>::clone(unsafe { &*self.contents.result })))
5622                         } }
5623                 } else {
5624                         Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr {
5625                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5626                         } }
5627                 }
5628         }
5629 }
5630 #[no_mangle]
5631 pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { orig.clone() }
5632 #[repr(C)]
5633 pub union CResult_InitDecodeErrorZPtr {
5634         pub result: *mut crate::ln::msgs::Init,
5635         pub err: *mut crate::ln::msgs::DecodeError,
5636 }
5637 #[repr(C)]
5638 pub struct CResult_InitDecodeErrorZ {
5639         pub contents: CResult_InitDecodeErrorZPtr,
5640         pub result_ok: bool,
5641 }
5642 #[no_mangle]
5643 pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::ln::msgs::Init) -> CResult_InitDecodeErrorZ {
5644         CResult_InitDecodeErrorZ {
5645                 contents: CResult_InitDecodeErrorZPtr {
5646                         result: Box::into_raw(Box::new(o)),
5647                 },
5648                 result_ok: true,
5649         }
5650 }
5651 #[no_mangle]
5652 pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ {
5653         CResult_InitDecodeErrorZ {
5654                 contents: CResult_InitDecodeErrorZPtr {
5655                         err: Box::into_raw(Box::new(e)),
5656                 },
5657                 result_ok: false,
5658         }
5659 }
5660 #[no_mangle]
5661 pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { }
5662 impl Drop for CResult_InitDecodeErrorZ {
5663         fn drop(&mut self) {
5664                 if self.result_ok {
5665                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5666                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5667                         }
5668                 } else {
5669                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5670                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5671                         }
5672                 }
5673         }
5674 }
5675 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>> for CResult_InitDecodeErrorZ {
5676         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Init, crate::ln::msgs::DecodeError>) -> Self {
5677                 let contents = if o.result_ok {
5678                         let result = unsafe { o.contents.result };
5679                         unsafe { o.contents.result = std::ptr::null_mut() };
5680                         CResult_InitDecodeErrorZPtr { result }
5681                 } else {
5682                         let err = unsafe { o.contents.err };
5683                         unsafe { o.contents.err = std::ptr::null_mut(); }
5684                         CResult_InitDecodeErrorZPtr { err }
5685                 };
5686                 Self {
5687                         contents,
5688                         result_ok: o.result_ok,
5689                 }
5690         }
5691 }
5692 impl Clone for CResult_InitDecodeErrorZ {
5693         fn clone(&self) -> Self {
5694                 if self.result_ok {
5695                         Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr {
5696                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Init>::clone(unsafe { &*self.contents.result })))
5697                         } }
5698                 } else {
5699                         Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr {
5700                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5701                         } }
5702                 }
5703         }
5704 }
5705 #[no_mangle]
5706 pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { orig.clone() }
5707 #[repr(C)]
5708 pub union CResult_OpenChannelDecodeErrorZPtr {
5709         pub result: *mut crate::ln::msgs::OpenChannel,
5710         pub err: *mut crate::ln::msgs::DecodeError,
5711 }
5712 #[repr(C)]
5713 pub struct CResult_OpenChannelDecodeErrorZ {
5714         pub contents: CResult_OpenChannelDecodeErrorZPtr,
5715         pub result_ok: bool,
5716 }
5717 #[no_mangle]
5718 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ {
5719         CResult_OpenChannelDecodeErrorZ {
5720                 contents: CResult_OpenChannelDecodeErrorZPtr {
5721                         result: Box::into_raw(Box::new(o)),
5722                 },
5723                 result_ok: true,
5724         }
5725 }
5726 #[no_mangle]
5727 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ {
5728         CResult_OpenChannelDecodeErrorZ {
5729                 contents: CResult_OpenChannelDecodeErrorZPtr {
5730                         err: Box::into_raw(Box::new(e)),
5731                 },
5732                 result_ok: false,
5733         }
5734 }
5735 #[no_mangle]
5736 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { }
5737 impl Drop for CResult_OpenChannelDecodeErrorZ {
5738         fn drop(&mut self) {
5739                 if self.result_ok {
5740                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5741                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5742                         }
5743                 } else {
5744                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5745                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5746                         }
5747                 }
5748         }
5749 }
5750 impl From<crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>> for CResult_OpenChannelDecodeErrorZ {
5751         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::OpenChannel, crate::ln::msgs::DecodeError>) -> Self {
5752                 let contents = if o.result_ok {
5753                         let result = unsafe { o.contents.result };
5754                         unsafe { o.contents.result = std::ptr::null_mut() };
5755                         CResult_OpenChannelDecodeErrorZPtr { result }
5756                 } else {
5757                         let err = unsafe { o.contents.err };
5758                         unsafe { o.contents.err = std::ptr::null_mut(); }
5759                         CResult_OpenChannelDecodeErrorZPtr { err }
5760                 };
5761                 Self {
5762                         contents,
5763                         result_ok: o.result_ok,
5764                 }
5765         }
5766 }
5767 impl Clone for CResult_OpenChannelDecodeErrorZ {
5768         fn clone(&self) -> Self {
5769                 if self.result_ok {
5770                         Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr {
5771                                 result: Box::into_raw(Box::new(<crate::ln::msgs::OpenChannel>::clone(unsafe { &*self.contents.result })))
5772                         } }
5773                 } else {
5774                         Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr {
5775                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5776                         } }
5777                 }
5778         }
5779 }
5780 #[no_mangle]
5781 pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { orig.clone() }
5782 #[repr(C)]
5783 pub union CResult_RevokeAndACKDecodeErrorZPtr {
5784         pub result: *mut crate::ln::msgs::RevokeAndACK,
5785         pub err: *mut crate::ln::msgs::DecodeError,
5786 }
5787 #[repr(C)]
5788 pub struct CResult_RevokeAndACKDecodeErrorZ {
5789         pub contents: CResult_RevokeAndACKDecodeErrorZPtr,
5790         pub result_ok: bool,
5791 }
5792 #[no_mangle]
5793 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ {
5794         CResult_RevokeAndACKDecodeErrorZ {
5795                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5796                         result: Box::into_raw(Box::new(o)),
5797                 },
5798                 result_ok: true,
5799         }
5800 }
5801 #[no_mangle]
5802 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ {
5803         CResult_RevokeAndACKDecodeErrorZ {
5804                 contents: CResult_RevokeAndACKDecodeErrorZPtr {
5805                         err: Box::into_raw(Box::new(e)),
5806                 },
5807                 result_ok: false,
5808         }
5809 }
5810 #[no_mangle]
5811 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { }
5812 impl Drop for CResult_RevokeAndACKDecodeErrorZ {
5813         fn drop(&mut self) {
5814                 if self.result_ok {
5815                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5816                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5817                         }
5818                 } else {
5819                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5820                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5821                         }
5822                 }
5823         }
5824 }
5825 impl From<crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>> for CResult_RevokeAndACKDecodeErrorZ {
5826         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::RevokeAndACK, crate::ln::msgs::DecodeError>) -> Self {
5827                 let contents = if o.result_ok {
5828                         let result = unsafe { o.contents.result };
5829                         unsafe { o.contents.result = std::ptr::null_mut() };
5830                         CResult_RevokeAndACKDecodeErrorZPtr { result }
5831                 } else {
5832                         let err = unsafe { o.contents.err };
5833                         unsafe { o.contents.err = std::ptr::null_mut(); }
5834                         CResult_RevokeAndACKDecodeErrorZPtr { err }
5835                 };
5836                 Self {
5837                         contents,
5838                         result_ok: o.result_ok,
5839                 }
5840         }
5841 }
5842 impl Clone for CResult_RevokeAndACKDecodeErrorZ {
5843         fn clone(&self) -> Self {
5844                 if self.result_ok {
5845                         Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr {
5846                                 result: Box::into_raw(Box::new(<crate::ln::msgs::RevokeAndACK>::clone(unsafe { &*self.contents.result })))
5847                         } }
5848                 } else {
5849                         Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr {
5850                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5851                         } }
5852                 }
5853         }
5854 }
5855 #[no_mangle]
5856 pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { orig.clone() }
5857 #[repr(C)]
5858 pub union CResult_ShutdownDecodeErrorZPtr {
5859         pub result: *mut crate::ln::msgs::Shutdown,
5860         pub err: *mut crate::ln::msgs::DecodeError,
5861 }
5862 #[repr(C)]
5863 pub struct CResult_ShutdownDecodeErrorZ {
5864         pub contents: CResult_ShutdownDecodeErrorZPtr,
5865         pub result_ok: bool,
5866 }
5867 #[no_mangle]
5868 pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ {
5869         CResult_ShutdownDecodeErrorZ {
5870                 contents: CResult_ShutdownDecodeErrorZPtr {
5871                         result: Box::into_raw(Box::new(o)),
5872                 },
5873                 result_ok: true,
5874         }
5875 }
5876 #[no_mangle]
5877 pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ {
5878         CResult_ShutdownDecodeErrorZ {
5879                 contents: CResult_ShutdownDecodeErrorZPtr {
5880                         err: Box::into_raw(Box::new(e)),
5881                 },
5882                 result_ok: false,
5883         }
5884 }
5885 #[no_mangle]
5886 pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { }
5887 impl Drop for CResult_ShutdownDecodeErrorZ {
5888         fn drop(&mut self) {
5889                 if self.result_ok {
5890                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5891                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5892                         }
5893                 } else {
5894                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5895                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5896                         }
5897                 }
5898         }
5899 }
5900 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>> for CResult_ShutdownDecodeErrorZ {
5901         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Shutdown, crate::ln::msgs::DecodeError>) -> Self {
5902                 let contents = if o.result_ok {
5903                         let result = unsafe { o.contents.result };
5904                         unsafe { o.contents.result = std::ptr::null_mut() };
5905                         CResult_ShutdownDecodeErrorZPtr { result }
5906                 } else {
5907                         let err = unsafe { o.contents.err };
5908                         unsafe { o.contents.err = std::ptr::null_mut(); }
5909                         CResult_ShutdownDecodeErrorZPtr { err }
5910                 };
5911                 Self {
5912                         contents,
5913                         result_ok: o.result_ok,
5914                 }
5915         }
5916 }
5917 impl Clone for CResult_ShutdownDecodeErrorZ {
5918         fn clone(&self) -> Self {
5919                 if self.result_ok {
5920                         Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr {
5921                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Shutdown>::clone(unsafe { &*self.contents.result })))
5922                         } }
5923                 } else {
5924                         Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr {
5925                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
5926                         } }
5927                 }
5928         }
5929 }
5930 #[no_mangle]
5931 pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { orig.clone() }
5932 #[repr(C)]
5933 pub union CResult_UpdateFailHTLCDecodeErrorZPtr {
5934         pub result: *mut crate::ln::msgs::UpdateFailHTLC,
5935         pub err: *mut crate::ln::msgs::DecodeError,
5936 }
5937 #[repr(C)]
5938 pub struct CResult_UpdateFailHTLCDecodeErrorZ {
5939         pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr,
5940         pub result_ok: bool,
5941 }
5942 #[no_mangle]
5943 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ {
5944         CResult_UpdateFailHTLCDecodeErrorZ {
5945                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5946                         result: Box::into_raw(Box::new(o)),
5947                 },
5948                 result_ok: true,
5949         }
5950 }
5951 #[no_mangle]
5952 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ {
5953         CResult_UpdateFailHTLCDecodeErrorZ {
5954                 contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5955                         err: Box::into_raw(Box::new(e)),
5956                 },
5957                 result_ok: false,
5958         }
5959 }
5960 #[no_mangle]
5961 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { }
5962 impl Drop for CResult_UpdateFailHTLCDecodeErrorZ {
5963         fn drop(&mut self) {
5964                 if self.result_ok {
5965                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
5966                                 let _ = unsafe { Box::from_raw(self.contents.result) };
5967                         }
5968                 } else {
5969                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
5970                                 let _ = unsafe { Box::from_raw(self.contents.err) };
5971                         }
5972                 }
5973         }
5974 }
5975 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailHTLCDecodeErrorZ {
5976         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailHTLC, crate::ln::msgs::DecodeError>) -> Self {
5977                 let contents = if o.result_ok {
5978                         let result = unsafe { o.contents.result };
5979                         unsafe { o.contents.result = std::ptr::null_mut() };
5980                         CResult_UpdateFailHTLCDecodeErrorZPtr { result }
5981                 } else {
5982                         let err = unsafe { o.contents.err };
5983                         unsafe { o.contents.err = std::ptr::null_mut(); }
5984                         CResult_UpdateFailHTLCDecodeErrorZPtr { err }
5985                 };
5986                 Self {
5987                         contents,
5988                         result_ok: o.result_ok,
5989                 }
5990         }
5991 }
5992 impl Clone for CResult_UpdateFailHTLCDecodeErrorZ {
5993         fn clone(&self) -> Self {
5994                 if self.result_ok {
5995                         Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
5996                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailHTLC>::clone(unsafe { &*self.contents.result })))
5997                         } }
5998                 } else {
5999                         Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr {
6000                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6001                         } }
6002                 }
6003         }
6004 }
6005 #[no_mangle]
6006 pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { orig.clone() }
6007 #[repr(C)]
6008 pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6009         pub result: *mut crate::ln::msgs::UpdateFailMalformedHTLC,
6010         pub err: *mut crate::ln::msgs::DecodeError,
6011 }
6012 #[repr(C)]
6013 pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6014         pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr,
6015         pub result_ok: bool,
6016 }
6017 #[no_mangle]
6018 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6019         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6020                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6021                         result: Box::into_raw(Box::new(o)),
6022                 },
6023                 result_ok: true,
6024         }
6025 }
6026 #[no_mangle]
6027 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6028         CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6029                 contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6030                         err: Box::into_raw(Box::new(e)),
6031                 },
6032                 result_ok: false,
6033         }
6034 }
6035 #[no_mangle]
6036 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { }
6037 impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6038         fn drop(&mut self) {
6039                 if self.result_ok {
6040                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6041                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6042                         }
6043                 } else {
6044                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6045                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6046                         }
6047                 }
6048         }
6049 }
6050 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6051         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFailMalformedHTLC, crate::ln::msgs::DecodeError>) -> Self {
6052                 let contents = if o.result_ok {
6053                         let result = unsafe { o.contents.result };
6054                         unsafe { o.contents.result = std::ptr::null_mut() };
6055                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result }
6056                 } else {
6057                         let err = unsafe { o.contents.err };
6058                         unsafe { o.contents.err = std::ptr::null_mut(); }
6059                         CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err }
6060                 };
6061                 Self {
6062                         contents,
6063                         result_ok: o.result_ok,
6064                 }
6065         }
6066 }
6067 impl Clone for CResult_UpdateFailMalformedHTLCDecodeErrorZ {
6068         fn clone(&self) -> Self {
6069                 if self.result_ok {
6070                         Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6071                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFailMalformedHTLC>::clone(unsafe { &*self.contents.result })))
6072                         } }
6073                 } else {
6074                         Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6075                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6076                         } }
6077                 }
6078         }
6079 }
6080 #[no_mangle]
6081 pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { orig.clone() }
6082 #[repr(C)]
6083 pub union CResult_UpdateFeeDecodeErrorZPtr {
6084         pub result: *mut crate::ln::msgs::UpdateFee,
6085         pub err: *mut crate::ln::msgs::DecodeError,
6086 }
6087 #[repr(C)]
6088 pub struct CResult_UpdateFeeDecodeErrorZ {
6089         pub contents: CResult_UpdateFeeDecodeErrorZPtr,
6090         pub result_ok: bool,
6091 }
6092 #[no_mangle]
6093 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ {
6094         CResult_UpdateFeeDecodeErrorZ {
6095                 contents: CResult_UpdateFeeDecodeErrorZPtr {
6096                         result: Box::into_raw(Box::new(o)),
6097                 },
6098                 result_ok: true,
6099         }
6100 }
6101 #[no_mangle]
6102 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ {
6103         CResult_UpdateFeeDecodeErrorZ {
6104                 contents: CResult_UpdateFeeDecodeErrorZPtr {
6105                         err: Box::into_raw(Box::new(e)),
6106                 },
6107                 result_ok: false,
6108         }
6109 }
6110 #[no_mangle]
6111 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { }
6112 impl Drop for CResult_UpdateFeeDecodeErrorZ {
6113         fn drop(&mut self) {
6114                 if self.result_ok {
6115                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6116                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6117                         }
6118                 } else {
6119                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6120                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6121                         }
6122                 }
6123         }
6124 }
6125 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>> for CResult_UpdateFeeDecodeErrorZ {
6126         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFee, crate::ln::msgs::DecodeError>) -> Self {
6127                 let contents = if o.result_ok {
6128                         let result = unsafe { o.contents.result };
6129                         unsafe { o.contents.result = std::ptr::null_mut() };
6130                         CResult_UpdateFeeDecodeErrorZPtr { result }
6131                 } else {
6132                         let err = unsafe { o.contents.err };
6133                         unsafe { o.contents.err = std::ptr::null_mut(); }
6134                         CResult_UpdateFeeDecodeErrorZPtr { err }
6135                 };
6136                 Self {
6137                         contents,
6138                         result_ok: o.result_ok,
6139                 }
6140         }
6141 }
6142 impl Clone for CResult_UpdateFeeDecodeErrorZ {
6143         fn clone(&self) -> Self {
6144                 if self.result_ok {
6145                         Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr {
6146                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFee>::clone(unsafe { &*self.contents.result })))
6147                         } }
6148                 } else {
6149                         Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr {
6150                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6151                         } }
6152                 }
6153         }
6154 }
6155 #[no_mangle]
6156 pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { orig.clone() }
6157 #[repr(C)]
6158 pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6159         pub result: *mut crate::ln::msgs::UpdateFulfillHTLC,
6160         pub err: *mut crate::ln::msgs::DecodeError,
6161 }
6162 #[repr(C)]
6163 pub struct CResult_UpdateFulfillHTLCDecodeErrorZ {
6164         pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr,
6165         pub result_ok: bool,
6166 }
6167 #[no_mangle]
6168 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
6169         CResult_UpdateFulfillHTLCDecodeErrorZ {
6170                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6171                         result: Box::into_raw(Box::new(o)),
6172                 },
6173                 result_ok: true,
6174         }
6175 }
6176 #[no_mangle]
6177 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ {
6178         CResult_UpdateFulfillHTLCDecodeErrorZ {
6179                 contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6180                         err: Box::into_raw(Box::new(e)),
6181                 },
6182                 result_ok: false,
6183         }
6184 }
6185 #[no_mangle]
6186 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { }
6187 impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ {
6188         fn drop(&mut self) {
6189                 if self.result_ok {
6190                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6191                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6192                         }
6193                 } else {
6194                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6195                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6196                         }
6197                 }
6198         }
6199 }
6200 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateFulfillHTLCDecodeErrorZ {
6201         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateFulfillHTLC, crate::ln::msgs::DecodeError>) -> Self {
6202                 let contents = if o.result_ok {
6203                         let result = unsafe { o.contents.result };
6204                         unsafe { o.contents.result = std::ptr::null_mut() };
6205                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { result }
6206                 } else {
6207                         let err = unsafe { o.contents.err };
6208                         unsafe { o.contents.err = std::ptr::null_mut(); }
6209                         CResult_UpdateFulfillHTLCDecodeErrorZPtr { err }
6210                 };
6211                 Self {
6212                         contents,
6213                         result_ok: o.result_ok,
6214                 }
6215         }
6216 }
6217 impl Clone for CResult_UpdateFulfillHTLCDecodeErrorZ {
6218         fn clone(&self) -> Self {
6219                 if self.result_ok {
6220                         Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6221                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateFulfillHTLC>::clone(unsafe { &*self.contents.result })))
6222                         } }
6223                 } else {
6224                         Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr {
6225                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6226                         } }
6227                 }
6228         }
6229 }
6230 #[no_mangle]
6231 pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { orig.clone() }
6232 #[repr(C)]
6233 pub union CResult_UpdateAddHTLCDecodeErrorZPtr {
6234         pub result: *mut crate::ln::msgs::UpdateAddHTLC,
6235         pub err: *mut crate::ln::msgs::DecodeError,
6236 }
6237 #[repr(C)]
6238 pub struct CResult_UpdateAddHTLCDecodeErrorZ {
6239         pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr,
6240         pub result_ok: bool,
6241 }
6242 #[no_mangle]
6243 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ {
6244         CResult_UpdateAddHTLCDecodeErrorZ {
6245                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6246                         result: Box::into_raw(Box::new(o)),
6247                 },
6248                 result_ok: true,
6249         }
6250 }
6251 #[no_mangle]
6252 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ {
6253         CResult_UpdateAddHTLCDecodeErrorZ {
6254                 contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6255                         err: Box::into_raw(Box::new(e)),
6256                 },
6257                 result_ok: false,
6258         }
6259 }
6260 #[no_mangle]
6261 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { }
6262 impl Drop for CResult_UpdateAddHTLCDecodeErrorZ {
6263         fn drop(&mut self) {
6264                 if self.result_ok {
6265                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6266                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6267                         }
6268                 } else {
6269                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6270                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6271                         }
6272                 }
6273         }
6274 }
6275 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>> for CResult_UpdateAddHTLCDecodeErrorZ {
6276         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UpdateAddHTLC, crate::ln::msgs::DecodeError>) -> Self {
6277                 let contents = if o.result_ok {
6278                         let result = unsafe { o.contents.result };
6279                         unsafe { o.contents.result = std::ptr::null_mut() };
6280                         CResult_UpdateAddHTLCDecodeErrorZPtr { result }
6281                 } else {
6282                         let err = unsafe { o.contents.err };
6283                         unsafe { o.contents.err = std::ptr::null_mut(); }
6284                         CResult_UpdateAddHTLCDecodeErrorZPtr { err }
6285                 };
6286                 Self {
6287                         contents,
6288                         result_ok: o.result_ok,
6289                 }
6290         }
6291 }
6292 impl Clone for CResult_UpdateAddHTLCDecodeErrorZ {
6293         fn clone(&self) -> Self {
6294                 if self.result_ok {
6295                         Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6296                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UpdateAddHTLC>::clone(unsafe { &*self.contents.result })))
6297                         } }
6298                 } else {
6299                         Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr {
6300                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6301                         } }
6302                 }
6303         }
6304 }
6305 #[no_mangle]
6306 pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { orig.clone() }
6307 #[repr(C)]
6308 pub union CResult_PingDecodeErrorZPtr {
6309         pub result: *mut crate::ln::msgs::Ping,
6310         pub err: *mut crate::ln::msgs::DecodeError,
6311 }
6312 #[repr(C)]
6313 pub struct CResult_PingDecodeErrorZ {
6314         pub contents: CResult_PingDecodeErrorZPtr,
6315         pub result_ok: bool,
6316 }
6317 #[no_mangle]
6318 pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::ln::msgs::Ping) -> CResult_PingDecodeErrorZ {
6319         CResult_PingDecodeErrorZ {
6320                 contents: CResult_PingDecodeErrorZPtr {
6321                         result: Box::into_raw(Box::new(o)),
6322                 },
6323                 result_ok: true,
6324         }
6325 }
6326 #[no_mangle]
6327 pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ {
6328         CResult_PingDecodeErrorZ {
6329                 contents: CResult_PingDecodeErrorZPtr {
6330                         err: Box::into_raw(Box::new(e)),
6331                 },
6332                 result_ok: false,
6333         }
6334 }
6335 #[no_mangle]
6336 pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { }
6337 impl Drop for CResult_PingDecodeErrorZ {
6338         fn drop(&mut self) {
6339                 if self.result_ok {
6340                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6341                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6342                         }
6343                 } else {
6344                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6345                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6346                         }
6347                 }
6348         }
6349 }
6350 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>> for CResult_PingDecodeErrorZ {
6351         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Ping, crate::ln::msgs::DecodeError>) -> Self {
6352                 let contents = if o.result_ok {
6353                         let result = unsafe { o.contents.result };
6354                         unsafe { o.contents.result = std::ptr::null_mut() };
6355                         CResult_PingDecodeErrorZPtr { result }
6356                 } else {
6357                         let err = unsafe { o.contents.err };
6358                         unsafe { o.contents.err = std::ptr::null_mut(); }
6359                         CResult_PingDecodeErrorZPtr { err }
6360                 };
6361                 Self {
6362                         contents,
6363                         result_ok: o.result_ok,
6364                 }
6365         }
6366 }
6367 impl Clone for CResult_PingDecodeErrorZ {
6368         fn clone(&self) -> Self {
6369                 if self.result_ok {
6370                         Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr {
6371                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Ping>::clone(unsafe { &*self.contents.result })))
6372                         } }
6373                 } else {
6374                         Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr {
6375                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6376                         } }
6377                 }
6378         }
6379 }
6380 #[no_mangle]
6381 pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { orig.clone() }
6382 #[repr(C)]
6383 pub union CResult_PongDecodeErrorZPtr {
6384         pub result: *mut crate::ln::msgs::Pong,
6385         pub err: *mut crate::ln::msgs::DecodeError,
6386 }
6387 #[repr(C)]
6388 pub struct CResult_PongDecodeErrorZ {
6389         pub contents: CResult_PongDecodeErrorZPtr,
6390         pub result_ok: bool,
6391 }
6392 #[no_mangle]
6393 pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::ln::msgs::Pong) -> CResult_PongDecodeErrorZ {
6394         CResult_PongDecodeErrorZ {
6395                 contents: CResult_PongDecodeErrorZPtr {
6396                         result: Box::into_raw(Box::new(o)),
6397                 },
6398                 result_ok: true,
6399         }
6400 }
6401 #[no_mangle]
6402 pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ {
6403         CResult_PongDecodeErrorZ {
6404                 contents: CResult_PongDecodeErrorZPtr {
6405                         err: Box::into_raw(Box::new(e)),
6406                 },
6407                 result_ok: false,
6408         }
6409 }
6410 #[no_mangle]
6411 pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { }
6412 impl Drop for CResult_PongDecodeErrorZ {
6413         fn drop(&mut self) {
6414                 if self.result_ok {
6415                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6416                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6417                         }
6418                 } else {
6419                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6420                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6421                         }
6422                 }
6423         }
6424 }
6425 impl From<crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>> for CResult_PongDecodeErrorZ {
6426         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::Pong, crate::ln::msgs::DecodeError>) -> Self {
6427                 let contents = if o.result_ok {
6428                         let result = unsafe { o.contents.result };
6429                         unsafe { o.contents.result = std::ptr::null_mut() };
6430                         CResult_PongDecodeErrorZPtr { result }
6431                 } else {
6432                         let err = unsafe { o.contents.err };
6433                         unsafe { o.contents.err = std::ptr::null_mut(); }
6434                         CResult_PongDecodeErrorZPtr { err }
6435                 };
6436                 Self {
6437                         contents,
6438                         result_ok: o.result_ok,
6439                 }
6440         }
6441 }
6442 impl Clone for CResult_PongDecodeErrorZ {
6443         fn clone(&self) -> Self {
6444                 if self.result_ok {
6445                         Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr {
6446                                 result: Box::into_raw(Box::new(<crate::ln::msgs::Pong>::clone(unsafe { &*self.contents.result })))
6447                         } }
6448                 } else {
6449                         Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr {
6450                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6451                         } }
6452                 }
6453         }
6454 }
6455 #[no_mangle]
6456 pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { orig.clone() }
6457 #[repr(C)]
6458 pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6459         pub result: *mut crate::ln::msgs::UnsignedChannelAnnouncement,
6460         pub err: *mut crate::ln::msgs::DecodeError,
6461 }
6462 #[repr(C)]
6463 pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6464         pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr,
6465         pub result_ok: bool,
6466 }
6467 #[no_mangle]
6468 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6469         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6470                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6471                         result: Box::into_raw(Box::new(o)),
6472                 },
6473                 result_ok: true,
6474         }
6475 }
6476 #[no_mangle]
6477 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6478         CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6479                 contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6480                         err: Box::into_raw(Box::new(e)),
6481                 },
6482                 result_ok: false,
6483         }
6484 }
6485 #[no_mangle]
6486 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { }
6487 impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6488         fn drop(&mut self) {
6489                 if self.result_ok {
6490                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6491                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6492                         }
6493                 } else {
6494                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6495                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6496                         }
6497                 }
6498         }
6499 }
6500 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6501         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6502                 let contents = if o.result_ok {
6503                         let result = unsafe { o.contents.result };
6504                         unsafe { o.contents.result = std::ptr::null_mut() };
6505                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result }
6506                 } else {
6507                         let err = unsafe { o.contents.err };
6508                         unsafe { o.contents.err = std::ptr::null_mut(); }
6509                         CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err }
6510                 };
6511                 Self {
6512                         contents,
6513                         result_ok: o.result_ok,
6514                 }
6515         }
6516 }
6517 impl Clone for CResult_UnsignedChannelAnnouncementDecodeErrorZ {
6518         fn clone(&self) -> Self {
6519                 if self.result_ok {
6520                         Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6521                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6522                         } }
6523                 } else {
6524                         Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
6525                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6526                         } }
6527                 }
6528         }
6529 }
6530 #[no_mangle]
6531 pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { orig.clone() }
6532 #[repr(C)]
6533 pub union CResult_ChannelAnnouncementDecodeErrorZPtr {
6534         pub result: *mut crate::ln::msgs::ChannelAnnouncement,
6535         pub err: *mut crate::ln::msgs::DecodeError,
6536 }
6537 #[repr(C)]
6538 pub struct CResult_ChannelAnnouncementDecodeErrorZ {
6539         pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr,
6540         pub result_ok: bool,
6541 }
6542 #[no_mangle]
6543 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ {
6544         CResult_ChannelAnnouncementDecodeErrorZ {
6545                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6546                         result: Box::into_raw(Box::new(o)),
6547                 },
6548                 result_ok: true,
6549         }
6550 }
6551 #[no_mangle]
6552 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ {
6553         CResult_ChannelAnnouncementDecodeErrorZ {
6554                 contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6555                         err: Box::into_raw(Box::new(e)),
6556                 },
6557                 result_ok: false,
6558         }
6559 }
6560 #[no_mangle]
6561 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { }
6562 impl Drop for CResult_ChannelAnnouncementDecodeErrorZ {
6563         fn drop(&mut self) {
6564                 if self.result_ok {
6565                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6566                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6567                         }
6568                 } else {
6569                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6570                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6571                         }
6572                 }
6573         }
6574 }
6575 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>> for CResult_ChannelAnnouncementDecodeErrorZ {
6576         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6577                 let contents = if o.result_ok {
6578                         let result = unsafe { o.contents.result };
6579                         unsafe { o.contents.result = std::ptr::null_mut() };
6580                         CResult_ChannelAnnouncementDecodeErrorZPtr { result }
6581                 } else {
6582                         let err = unsafe { o.contents.err };
6583                         unsafe { o.contents.err = std::ptr::null_mut(); }
6584                         CResult_ChannelAnnouncementDecodeErrorZPtr { err }
6585                 };
6586                 Self {
6587                         contents,
6588                         result_ok: o.result_ok,
6589                 }
6590         }
6591 }
6592 impl Clone for CResult_ChannelAnnouncementDecodeErrorZ {
6593         fn clone(&self) -> Self {
6594                 if self.result_ok {
6595                         Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6596                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelAnnouncement>::clone(unsafe { &*self.contents.result })))
6597                         } }
6598                 } else {
6599                         Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr {
6600                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6601                         } }
6602                 }
6603         }
6604 }
6605 #[no_mangle]
6606 pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { orig.clone() }
6607 #[repr(C)]
6608 pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6609         pub result: *mut crate::ln::msgs::UnsignedChannelUpdate,
6610         pub err: *mut crate::ln::msgs::DecodeError,
6611 }
6612 #[repr(C)]
6613 pub struct CResult_UnsignedChannelUpdateDecodeErrorZ {
6614         pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr,
6615         pub result_ok: bool,
6616 }
6617 #[no_mangle]
6618 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6619         CResult_UnsignedChannelUpdateDecodeErrorZ {
6620                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6621                         result: Box::into_raw(Box::new(o)),
6622                 },
6623                 result_ok: true,
6624         }
6625 }
6626 #[no_mangle]
6627 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ {
6628         CResult_UnsignedChannelUpdateDecodeErrorZ {
6629                 contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6630                         err: Box::into_raw(Box::new(e)),
6631                 },
6632                 result_ok: false,
6633         }
6634 }
6635 #[no_mangle]
6636 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { }
6637 impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ {
6638         fn drop(&mut self) {
6639                 if self.result_ok {
6640                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6641                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6642                         }
6643                 } else {
6644                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6645                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6646                         }
6647                 }
6648         }
6649 }
6650 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_UnsignedChannelUpdateDecodeErrorZ {
6651         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
6652                 let contents = if o.result_ok {
6653                         let result = unsafe { o.contents.result };
6654                         unsafe { o.contents.result = std::ptr::null_mut() };
6655                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { result }
6656                 } else {
6657                         let err = unsafe { o.contents.err };
6658                         unsafe { o.contents.err = std::ptr::null_mut(); }
6659                         CResult_UnsignedChannelUpdateDecodeErrorZPtr { err }
6660                 };
6661                 Self {
6662                         contents,
6663                         result_ok: o.result_ok,
6664                 }
6665         }
6666 }
6667 impl Clone for CResult_UnsignedChannelUpdateDecodeErrorZ {
6668         fn clone(&self) -> Self {
6669                 if self.result_ok {
6670                         Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6671                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedChannelUpdate>::clone(unsafe { &*self.contents.result })))
6672                         } }
6673                 } else {
6674                         Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr {
6675                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6676                         } }
6677                 }
6678         }
6679 }
6680 #[no_mangle]
6681 pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { orig.clone() }
6682 #[repr(C)]
6683 pub union CResult_ChannelUpdateDecodeErrorZPtr {
6684         pub result: *mut crate::ln::msgs::ChannelUpdate,
6685         pub err: *mut crate::ln::msgs::DecodeError,
6686 }
6687 #[repr(C)]
6688 pub struct CResult_ChannelUpdateDecodeErrorZ {
6689         pub contents: CResult_ChannelUpdateDecodeErrorZPtr,
6690         pub result_ok: bool,
6691 }
6692 #[no_mangle]
6693 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ {
6694         CResult_ChannelUpdateDecodeErrorZ {
6695                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
6696                         result: Box::into_raw(Box::new(o)),
6697                 },
6698                 result_ok: true,
6699         }
6700 }
6701 #[no_mangle]
6702 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ {
6703         CResult_ChannelUpdateDecodeErrorZ {
6704                 contents: CResult_ChannelUpdateDecodeErrorZPtr {
6705                         err: Box::into_raw(Box::new(e)),
6706                 },
6707                 result_ok: false,
6708         }
6709 }
6710 #[no_mangle]
6711 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { }
6712 impl Drop for CResult_ChannelUpdateDecodeErrorZ {
6713         fn drop(&mut self) {
6714                 if self.result_ok {
6715                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6716                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6717                         }
6718                 } else {
6719                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6720                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6721                         }
6722                 }
6723         }
6724 }
6725 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>> for CResult_ChannelUpdateDecodeErrorZ {
6726         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ChannelUpdate, crate::ln::msgs::DecodeError>) -> Self {
6727                 let contents = if o.result_ok {
6728                         let result = unsafe { o.contents.result };
6729                         unsafe { o.contents.result = std::ptr::null_mut() };
6730                         CResult_ChannelUpdateDecodeErrorZPtr { result }
6731                 } else {
6732                         let err = unsafe { o.contents.err };
6733                         unsafe { o.contents.err = std::ptr::null_mut(); }
6734                         CResult_ChannelUpdateDecodeErrorZPtr { err }
6735                 };
6736                 Self {
6737                         contents,
6738                         result_ok: o.result_ok,
6739                 }
6740         }
6741 }
6742 impl Clone for CResult_ChannelUpdateDecodeErrorZ {
6743         fn clone(&self) -> Self {
6744                 if self.result_ok {
6745                         Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr {
6746                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ChannelUpdate>::clone(unsafe { &*self.contents.result })))
6747                         } }
6748                 } else {
6749                         Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr {
6750                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6751                         } }
6752                 }
6753         }
6754 }
6755 #[no_mangle]
6756 pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { orig.clone() }
6757 #[repr(C)]
6758 pub union CResult_ErrorMessageDecodeErrorZPtr {
6759         pub result: *mut crate::ln::msgs::ErrorMessage,
6760         pub err: *mut crate::ln::msgs::DecodeError,
6761 }
6762 #[repr(C)]
6763 pub struct CResult_ErrorMessageDecodeErrorZ {
6764         pub contents: CResult_ErrorMessageDecodeErrorZPtr,
6765         pub result_ok: bool,
6766 }
6767 #[no_mangle]
6768 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ {
6769         CResult_ErrorMessageDecodeErrorZ {
6770                 contents: CResult_ErrorMessageDecodeErrorZPtr {
6771                         result: Box::into_raw(Box::new(o)),
6772                 },
6773                 result_ok: true,
6774         }
6775 }
6776 #[no_mangle]
6777 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ {
6778         CResult_ErrorMessageDecodeErrorZ {
6779                 contents: CResult_ErrorMessageDecodeErrorZPtr {
6780                         err: Box::into_raw(Box::new(e)),
6781                 },
6782                 result_ok: false,
6783         }
6784 }
6785 #[no_mangle]
6786 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { }
6787 impl Drop for CResult_ErrorMessageDecodeErrorZ {
6788         fn drop(&mut self) {
6789                 if self.result_ok {
6790                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6791                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6792                         }
6793                 } else {
6794                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6795                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6796                         }
6797                 }
6798         }
6799 }
6800 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>> for CResult_ErrorMessageDecodeErrorZ {
6801         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ErrorMessage, crate::ln::msgs::DecodeError>) -> Self {
6802                 let contents = if o.result_ok {
6803                         let result = unsafe { o.contents.result };
6804                         unsafe { o.contents.result = std::ptr::null_mut() };
6805                         CResult_ErrorMessageDecodeErrorZPtr { result }
6806                 } else {
6807                         let err = unsafe { o.contents.err };
6808                         unsafe { o.contents.err = std::ptr::null_mut(); }
6809                         CResult_ErrorMessageDecodeErrorZPtr { err }
6810                 };
6811                 Self {
6812                         contents,
6813                         result_ok: o.result_ok,
6814                 }
6815         }
6816 }
6817 impl Clone for CResult_ErrorMessageDecodeErrorZ {
6818         fn clone(&self) -> Self {
6819                 if self.result_ok {
6820                         Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr {
6821                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ErrorMessage>::clone(unsafe { &*self.contents.result })))
6822                         } }
6823                 } else {
6824                         Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr {
6825                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6826                         } }
6827                 }
6828         }
6829 }
6830 #[no_mangle]
6831 pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { orig.clone() }
6832 #[repr(C)]
6833 pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6834         pub result: *mut crate::ln::msgs::UnsignedNodeAnnouncement,
6835         pub err: *mut crate::ln::msgs::DecodeError,
6836 }
6837 #[repr(C)]
6838 pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6839         pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr,
6840         pub result_ok: bool,
6841 }
6842 #[no_mangle]
6843 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6844         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6845                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6846                         result: Box::into_raw(Box::new(o)),
6847                 },
6848                 result_ok: true,
6849         }
6850 }
6851 #[no_mangle]
6852 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6853         CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6854                 contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6855                         err: Box::into_raw(Box::new(e)),
6856                 },
6857                 result_ok: false,
6858         }
6859 }
6860 #[no_mangle]
6861 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { }
6862 impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6863         fn drop(&mut self) {
6864                 if self.result_ok {
6865                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6866                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6867                         }
6868                 } else {
6869                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6870                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6871                         }
6872                 }
6873         }
6874 }
6875 impl From<crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6876         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::UnsignedNodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6877                 let contents = if o.result_ok {
6878                         let result = unsafe { o.contents.result };
6879                         unsafe { o.contents.result = std::ptr::null_mut() };
6880                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result }
6881                 } else {
6882                         let err = unsafe { o.contents.err };
6883                         unsafe { o.contents.err = std::ptr::null_mut(); }
6884                         CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err }
6885                 };
6886                 Self {
6887                         contents,
6888                         result_ok: o.result_ok,
6889                 }
6890         }
6891 }
6892 impl Clone for CResult_UnsignedNodeAnnouncementDecodeErrorZ {
6893         fn clone(&self) -> Self {
6894                 if self.result_ok {
6895                         Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6896                                 result: Box::into_raw(Box::new(<crate::ln::msgs::UnsignedNodeAnnouncement>::clone(unsafe { &*self.contents.result })))
6897                         } }
6898                 } else {
6899                         Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
6900                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6901                         } }
6902                 }
6903         }
6904 }
6905 #[no_mangle]
6906 pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { orig.clone() }
6907 #[repr(C)]
6908 pub union CResult_NodeAnnouncementDecodeErrorZPtr {
6909         pub result: *mut crate::ln::msgs::NodeAnnouncement,
6910         pub err: *mut crate::ln::msgs::DecodeError,
6911 }
6912 #[repr(C)]
6913 pub struct CResult_NodeAnnouncementDecodeErrorZ {
6914         pub contents: CResult_NodeAnnouncementDecodeErrorZPtr,
6915         pub result_ok: bool,
6916 }
6917 #[no_mangle]
6918 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ {
6919         CResult_NodeAnnouncementDecodeErrorZ {
6920                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6921                         result: Box::into_raw(Box::new(o)),
6922                 },
6923                 result_ok: true,
6924         }
6925 }
6926 #[no_mangle]
6927 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ {
6928         CResult_NodeAnnouncementDecodeErrorZ {
6929                 contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6930                         err: Box::into_raw(Box::new(e)),
6931                 },
6932                 result_ok: false,
6933         }
6934 }
6935 #[no_mangle]
6936 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { }
6937 impl Drop for CResult_NodeAnnouncementDecodeErrorZ {
6938         fn drop(&mut self) {
6939                 if self.result_ok {
6940                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
6941                                 let _ = unsafe { Box::from_raw(self.contents.result) };
6942                         }
6943                 } else {
6944                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
6945                                 let _ = unsafe { Box::from_raw(self.contents.err) };
6946                         }
6947                 }
6948         }
6949 }
6950 impl From<crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>> for CResult_NodeAnnouncementDecodeErrorZ {
6951         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::NodeAnnouncement, crate::ln::msgs::DecodeError>) -> Self {
6952                 let contents = if o.result_ok {
6953                         let result = unsafe { o.contents.result };
6954                         unsafe { o.contents.result = std::ptr::null_mut() };
6955                         CResult_NodeAnnouncementDecodeErrorZPtr { result }
6956                 } else {
6957                         let err = unsafe { o.contents.err };
6958                         unsafe { o.contents.err = std::ptr::null_mut(); }
6959                         CResult_NodeAnnouncementDecodeErrorZPtr { err }
6960                 };
6961                 Self {
6962                         contents,
6963                         result_ok: o.result_ok,
6964                 }
6965         }
6966 }
6967 impl Clone for CResult_NodeAnnouncementDecodeErrorZ {
6968         fn clone(&self) -> Self {
6969                 if self.result_ok {
6970                         Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6971                                 result: Box::into_raw(Box::new(<crate::ln::msgs::NodeAnnouncement>::clone(unsafe { &*self.contents.result })))
6972                         } }
6973                 } else {
6974                         Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr {
6975                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
6976                         } }
6977                 }
6978         }
6979 }
6980 #[no_mangle]
6981 pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { orig.clone() }
6982 #[repr(C)]
6983 pub union CResult_QueryShortChannelIdsDecodeErrorZPtr {
6984         pub result: *mut crate::ln::msgs::QueryShortChannelIds,
6985         pub err: *mut crate::ln::msgs::DecodeError,
6986 }
6987 #[repr(C)]
6988 pub struct CResult_QueryShortChannelIdsDecodeErrorZ {
6989         pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr,
6990         pub result_ok: bool,
6991 }
6992 #[no_mangle]
6993 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ {
6994         CResult_QueryShortChannelIdsDecodeErrorZ {
6995                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
6996                         result: Box::into_raw(Box::new(o)),
6997                 },
6998                 result_ok: true,
6999         }
7000 }
7001 #[no_mangle]
7002 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ {
7003         CResult_QueryShortChannelIdsDecodeErrorZ {
7004                 contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7005                         err: Box::into_raw(Box::new(e)),
7006                 },
7007                 result_ok: false,
7008         }
7009 }
7010 #[no_mangle]
7011 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { }
7012 impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ {
7013         fn drop(&mut self) {
7014                 if self.result_ok {
7015                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7016                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7017                         }
7018                 } else {
7019                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7020                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7021                         }
7022                 }
7023         }
7024 }
7025 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>> for CResult_QueryShortChannelIdsDecodeErrorZ {
7026         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryShortChannelIds, crate::ln::msgs::DecodeError>) -> Self {
7027                 let contents = if o.result_ok {
7028                         let result = unsafe { o.contents.result };
7029                         unsafe { o.contents.result = std::ptr::null_mut() };
7030                         CResult_QueryShortChannelIdsDecodeErrorZPtr { result }
7031                 } else {
7032                         let err = unsafe { o.contents.err };
7033                         unsafe { o.contents.err = std::ptr::null_mut(); }
7034                         CResult_QueryShortChannelIdsDecodeErrorZPtr { err }
7035                 };
7036                 Self {
7037                         contents,
7038                         result_ok: o.result_ok,
7039                 }
7040         }
7041 }
7042 impl Clone for CResult_QueryShortChannelIdsDecodeErrorZ {
7043         fn clone(&self) -> Self {
7044                 if self.result_ok {
7045                         Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7046                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryShortChannelIds>::clone(unsafe { &*self.contents.result })))
7047                         } }
7048                 } else {
7049                         Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr {
7050                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7051                         } }
7052                 }
7053         }
7054 }
7055 #[no_mangle]
7056 pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { orig.clone() }
7057 #[repr(C)]
7058 pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7059         pub result: *mut crate::ln::msgs::ReplyShortChannelIdsEnd,
7060         pub err: *mut crate::ln::msgs::DecodeError,
7061 }
7062 #[repr(C)]
7063 pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7064         pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr,
7065         pub result_ok: bool,
7066 }
7067 #[no_mangle]
7068 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7069         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7070                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7071                         result: Box::into_raw(Box::new(o)),
7072                 },
7073                 result_ok: true,
7074         }
7075 }
7076 #[no_mangle]
7077 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7078         CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7079                 contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7080                         err: Box::into_raw(Box::new(e)),
7081                 },
7082                 result_ok: false,
7083         }
7084 }
7085 #[no_mangle]
7086 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { }
7087 impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7088         fn drop(&mut self) {
7089                 if self.result_ok {
7090                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7091                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7092                         }
7093                 } else {
7094                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7095                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7096                         }
7097                 }
7098         }
7099 }
7100 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>> for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7101         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyShortChannelIdsEnd, crate::ln::msgs::DecodeError>) -> Self {
7102                 let contents = if o.result_ok {
7103                         let result = unsafe { o.contents.result };
7104                         unsafe { o.contents.result = std::ptr::null_mut() };
7105                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result }
7106                 } else {
7107                         let err = unsafe { o.contents.err };
7108                         unsafe { o.contents.err = std::ptr::null_mut(); }
7109                         CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err }
7110                 };
7111                 Self {
7112                         contents,
7113                         result_ok: o.result_ok,
7114                 }
7115         }
7116 }
7117 impl Clone for CResult_ReplyShortChannelIdsEndDecodeErrorZ {
7118         fn clone(&self) -> Self {
7119                 if self.result_ok {
7120                         Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7121                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyShortChannelIdsEnd>::clone(unsafe { &*self.contents.result })))
7122                         } }
7123                 } else {
7124                         Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7125                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7126                         } }
7127                 }
7128         }
7129 }
7130 #[no_mangle]
7131 pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { orig.clone() }
7132 #[repr(C)]
7133 pub union CResult_QueryChannelRangeDecodeErrorZPtr {
7134         pub result: *mut crate::ln::msgs::QueryChannelRange,
7135         pub err: *mut crate::ln::msgs::DecodeError,
7136 }
7137 #[repr(C)]
7138 pub struct CResult_QueryChannelRangeDecodeErrorZ {
7139         pub contents: CResult_QueryChannelRangeDecodeErrorZPtr,
7140         pub result_ok: bool,
7141 }
7142 #[no_mangle]
7143 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ {
7144         CResult_QueryChannelRangeDecodeErrorZ {
7145                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7146                         result: Box::into_raw(Box::new(o)),
7147                 },
7148                 result_ok: true,
7149         }
7150 }
7151 #[no_mangle]
7152 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ {
7153         CResult_QueryChannelRangeDecodeErrorZ {
7154                 contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7155                         err: Box::into_raw(Box::new(e)),
7156                 },
7157                 result_ok: false,
7158         }
7159 }
7160 #[no_mangle]
7161 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { }
7162 impl Drop for CResult_QueryChannelRangeDecodeErrorZ {
7163         fn drop(&mut self) {
7164                 if self.result_ok {
7165                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7166                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7167                         }
7168                 } else {
7169                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7170                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7171                         }
7172                 }
7173         }
7174 }
7175 impl From<crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>> for CResult_QueryChannelRangeDecodeErrorZ {
7176         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::QueryChannelRange, crate::ln::msgs::DecodeError>) -> Self {
7177                 let contents = if o.result_ok {
7178                         let result = unsafe { o.contents.result };
7179                         unsafe { o.contents.result = std::ptr::null_mut() };
7180                         CResult_QueryChannelRangeDecodeErrorZPtr { result }
7181                 } else {
7182                         let err = unsafe { o.contents.err };
7183                         unsafe { o.contents.err = std::ptr::null_mut(); }
7184                         CResult_QueryChannelRangeDecodeErrorZPtr { err }
7185                 };
7186                 Self {
7187                         contents,
7188                         result_ok: o.result_ok,
7189                 }
7190         }
7191 }
7192 impl Clone for CResult_QueryChannelRangeDecodeErrorZ {
7193         fn clone(&self) -> Self {
7194                 if self.result_ok {
7195                         Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7196                                 result: Box::into_raw(Box::new(<crate::ln::msgs::QueryChannelRange>::clone(unsafe { &*self.contents.result })))
7197                         } }
7198                 } else {
7199                         Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr {
7200                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7201                         } }
7202                 }
7203         }
7204 }
7205 #[no_mangle]
7206 pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { orig.clone() }
7207 #[repr(C)]
7208 pub union CResult_ReplyChannelRangeDecodeErrorZPtr {
7209         pub result: *mut crate::ln::msgs::ReplyChannelRange,
7210         pub err: *mut crate::ln::msgs::DecodeError,
7211 }
7212 #[repr(C)]
7213 pub struct CResult_ReplyChannelRangeDecodeErrorZ {
7214         pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr,
7215         pub result_ok: bool,
7216 }
7217 #[no_mangle]
7218 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ {
7219         CResult_ReplyChannelRangeDecodeErrorZ {
7220                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7221                         result: Box::into_raw(Box::new(o)),
7222                 },
7223                 result_ok: true,
7224         }
7225 }
7226 #[no_mangle]
7227 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ {
7228         CResult_ReplyChannelRangeDecodeErrorZ {
7229                 contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7230                         err: Box::into_raw(Box::new(e)),
7231                 },
7232                 result_ok: false,
7233         }
7234 }
7235 #[no_mangle]
7236 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { }
7237 impl Drop for CResult_ReplyChannelRangeDecodeErrorZ {
7238         fn drop(&mut self) {
7239                 if self.result_ok {
7240                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7241                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7242                         }
7243                 } else {
7244                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7245                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7246                         }
7247                 }
7248         }
7249 }
7250 impl From<crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>> for CResult_ReplyChannelRangeDecodeErrorZ {
7251         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::ReplyChannelRange, crate::ln::msgs::DecodeError>) -> Self {
7252                 let contents = if o.result_ok {
7253                         let result = unsafe { o.contents.result };
7254                         unsafe { o.contents.result = std::ptr::null_mut() };
7255                         CResult_ReplyChannelRangeDecodeErrorZPtr { result }
7256                 } else {
7257                         let err = unsafe { o.contents.err };
7258                         unsafe { o.contents.err = std::ptr::null_mut(); }
7259                         CResult_ReplyChannelRangeDecodeErrorZPtr { err }
7260                 };
7261                 Self {
7262                         contents,
7263                         result_ok: o.result_ok,
7264                 }
7265         }
7266 }
7267 impl Clone for CResult_ReplyChannelRangeDecodeErrorZ {
7268         fn clone(&self) -> Self {
7269                 if self.result_ok {
7270                         Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7271                                 result: Box::into_raw(Box::new(<crate::ln::msgs::ReplyChannelRange>::clone(unsafe { &*self.contents.result })))
7272                         } }
7273                 } else {
7274                         Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr {
7275                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7276                         } }
7277                 }
7278         }
7279 }
7280 #[no_mangle]
7281 pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { orig.clone() }
7282 #[repr(C)]
7283 pub union CResult_GossipTimestampFilterDecodeErrorZPtr {
7284         pub result: *mut crate::ln::msgs::GossipTimestampFilter,
7285         pub err: *mut crate::ln::msgs::DecodeError,
7286 }
7287 #[repr(C)]
7288 pub struct CResult_GossipTimestampFilterDecodeErrorZ {
7289         pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr,
7290         pub result_ok: bool,
7291 }
7292 #[no_mangle]
7293 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ {
7294         CResult_GossipTimestampFilterDecodeErrorZ {
7295                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7296                         result: Box::into_raw(Box::new(o)),
7297                 },
7298                 result_ok: true,
7299         }
7300 }
7301 #[no_mangle]
7302 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ {
7303         CResult_GossipTimestampFilterDecodeErrorZ {
7304                 contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7305                         err: Box::into_raw(Box::new(e)),
7306                 },
7307                 result_ok: false,
7308         }
7309 }
7310 #[no_mangle]
7311 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { }
7312 impl Drop for CResult_GossipTimestampFilterDecodeErrorZ {
7313         fn drop(&mut self) {
7314                 if self.result_ok {
7315                         if unsafe { !(self.contents.result as *mut ()).is_null() } {
7316                                 let _ = unsafe { Box::from_raw(self.contents.result) };
7317                         }
7318                 } else {
7319                         if unsafe { !(self.contents.err as *mut ()).is_null() } {
7320                                 let _ = unsafe { Box::from_raw(self.contents.err) };
7321                         }
7322                 }
7323         }
7324 }
7325 impl From<crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>> for CResult_GossipTimestampFilterDecodeErrorZ {
7326         fn from(mut o: crate::c_types::CResultTempl<crate::ln::msgs::GossipTimestampFilter, crate::ln::msgs::DecodeError>) -> Self {
7327                 let contents = if o.result_ok {
7328                         let result = unsafe { o.contents.result };
7329                         unsafe { o.contents.result = std::ptr::null_mut() };
7330                         CResult_GossipTimestampFilterDecodeErrorZPtr { result }
7331                 } else {
7332                         let err = unsafe { o.contents.err };
7333                         unsafe { o.contents.err = std::ptr::null_mut(); }
7334                         CResult_GossipTimestampFilterDecodeErrorZPtr { err }
7335                 };
7336                 Self {
7337                         contents,
7338                         result_ok: o.result_ok,
7339                 }
7340         }
7341 }
7342 impl Clone for CResult_GossipTimestampFilterDecodeErrorZ {
7343         fn clone(&self) -> Self {
7344                 if self.result_ok {
7345                         Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7346                                 result: Box::into_raw(Box::new(<crate::ln::msgs::GossipTimestampFilter>::clone(unsafe { &*self.contents.result })))
7347                         } }
7348                 } else {
7349                         Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr {
7350                                 err: Box::into_raw(Box::new(<crate::ln::msgs::DecodeError>::clone(unsafe { &*self.contents.err })))
7351                         } }
7352                 }
7353         }
7354 }
7355 #[no_mangle]
7356 pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { orig.clone() }