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