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