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