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