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