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